How to do declaration in Visual studio 2022 if Top level statement is enabled?

24 Views Asked by At

I could only see Console.WriteLine("Hello, World") in Visual studio 2022. When referred this Link, the good old structure can be brought back, but question is, in this new template, how can we declare some fields, variable, constants etc, which can be used in Main().

For ex, I want to declare int number1 = 5; and then use it in Main method execution.

0

There are 0 best solutions below