← Back to context

Comment by qingcharles

3 months ago

That's how I learned C in the 80s. Just compile the C file into an EXE. It's a good way to get started.

That said, I'm certain you've always been able to simple compile a .cs to an .exe? When I ran guerilla C# programming classes in jail, I couldn't get anything from the outside, so I was stuck with the .Net v2 csc.exe which is squirreled away in a subfolder of Windows on a default install of Visa.

What .Net 10 adds though is the ability to even scrap main() and just write code like it was Basic.

You've needed to have a project file in the past to compile .cs files, and this gets rid of that need. There are things that are part of more esoteric corners of Roslyn like .csx files that have allowed similar behavior in the past, but this fronts .cs directly as a scripting solution.

Scraping main() has been a thing for a while in dotnet — so called "Top-level programs" have be in since C# 9/.NET 5, aka about 5 years ago.

https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals...