When working with single files, I recommend using the modern approach of C# Script:
dotnet tool install -g csharprepl
echo Console.WriteLine(args[0]); > file.csx
echo Console.WriteLine("Press CTRL + D to exit."); >> file.csx
csharprepl file.csx -- "Hello world!"
It is not possible to create executable files.
Not possible to use NuGet packages and declare namespaces.
Debugging complex code is difficult and should be avoided.