I started a project with the new console template that uses top level statements, but I wanted to add Program Main
back in anyway.
However, when I add in the class like this:
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
public class Program
{
public static void Main()
{
Console.WriteLine("Hello World");
}
}
I get the error:
error CS0260: Missing partial modifier on declaration of type 'Program';
Another partial declaration of this type exists
Other stack overflow questions say to just add partial
, but when I do that, I get the error:
warning CS7022: The entry point of the program is global code;
ignoring 'Program.Main()' entry point
What's going on here?