C#C
C#2y ago
Steadhaven

No Main and class confusion in newer C# versions

I am confused about the newer C# versions... When I make a console app, it just starts like so:
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

As you see, theres no class or Main method. In Java, and old C# if I am correct, we always have to have a class with a main method for our code to run.

However, it seems that newer C# versions doesn't require this. Yet my confusion is:
  • OOP is rather valuable in a lot of scenarios, so what do we do without classes?
  • Is the Main method just in the first file we create? or where is it? it seems to run without it
Was this page helpful?