Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Basics Methods Defining a Method

I'm getting an error CS8652 anyone can help, please? Thanks

Program.cs
using System;

class Program
{

    // YOUR CODE HERE: Define a method named Spell. Remember to use the
    // "static" and "void" keywords: "static void Spell" (without quotes)...

    static void Main(string[] args)
    {
    static void Spell();
    Console. WriteLine("c");
    Console. WriteLine("a");
    Console. WriteLine("t");  
    }
}

1 Answer

Hi Jehanzaib Khan,

The method Spell should be outside the main method and syntax for creating the Spell method is incorrect. It should look like below.

class Program { public static void Spell() { Console.WriteLine("c"); Console.WriteLine("a"); Console.WriteLine("t"); } public static void Main(string[] args) { Spell(); } }

Monika Polishetty Thank you so much for your help!!