If I add an enum to the default code for a new c# Console App:
// See https://aka.ms/new-console-template for more information
enum testEnum
{
one = 1,
two = 2
}
Console.WriteLine("Hello, World!");
I get the following error on the Console.WriteLine line:
Error CS8803 Top-level statements must precede namespace and type declarations.
Moving the enum to the bottom of the code fixes the error. Is there a way to keep the enum at the top and get rid of the error?