-
Notifications
You must be signed in to change notification settings - Fork 0
Introduction to top level C#
Lewis Page edited this page Mar 12, 2021
·
1 revision
Since dotnet 5.0
(C# 9.0), you have been able to write your main function without a class nor main function. This would mean that an entire C# file could just contain:
using System;
Console.WriteLine("Hello world");
and it will compile.
TLCS (Top Level C Sharp) is a tool designed to make that even more simple, as previously you would still need a .csproj
file for the .cs
file to run. With TLCS, all you need to do is type,
tlcs Program.cs
and your C# file will run like butter!
Simple, TLCS creates a dotnet repository in %tmp%
, and puts your code in there to run, overwriting that temp file every time a new file is run. Because of this, TLCS has all of the features of C#, and more!