© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
51 replies
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!");
// 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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

c# versions
C#CC# / help
3y ago
❔ Debugging Roslyn Components in newer visual studio versions?
C#CC# / help
3y ago
class constructor in c#
C#CC# / help
12mo ago
✅ Public class in C#
C#CC# / help
13mo ago