Hedron Dantas Hedron Dantas - 1 year ago 136
Bash Question

Run C# code on linux terminal

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

I have this sample code:

public string Check(string _IPaddress,string _Port, int _SmsID)
ClassGlobal._client = new TcpClient(_IPaddress, Convert.ToInt32(_Port));
ClassGlobal.SMSID = _SmsID;
string _result = SendToCAS(_IPaddress, _Port, _SmsID );
if (_result != "") return (_result);
string _acoknoledgement = GetFromCAS();
return _acoknoledgement;

When I run a shell bash I use
. There is how to do the same with c#?

Answer Source

The #! (hashbang) tag is used to tell the shell which interpreter to use so that your perl, php, bash, sh, etc. scripts will run right.

But C# is not a scripting language, it is intended to be compiled into an executable format. You need to install at least a compiler and runtime if you want to use C#, and preferably an IDE (Integrated Development Environment) to help you develop and debug your applications.

Install Mono for the compiler and runtime, then MonoDevelop for the IDE.