Run C# code on linux terminal

后端 未结 5 1972
慢半拍i
慢半拍i 2020-12-24 07:47

How can I execute a C# code on a linux terminal as a shell script.

I have this sample code:

public string Check(string _IPaddress,string _Port, int _         


        
5条回答
  •  攒了一身酷
    2020-12-24 08:07

    After installing mono you can use csharp hello.cs. Starting with Mono 2.10, you can also use the shebang like this:

    #!/usr/bin/csharp
    Console.WriteLine ("Hello, World");
    

    If you need assemblies, you can load them e.g. with the line LoadAssembly("System.IO.Compression") inside your script.

    Reference: man csharp.

提交回复
热议问题