在Linux终端上运行C#代码

编程入门 行业动态 更新时间:2024-10-26 18:21:30
本文介绍了在Linux终端上运行C#代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在Linux终端上执行C#代码作为Shell脚本.

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

我有以下示例代码:

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; }

当我运行shell bash时,我使用#!/bin/bash. C#有相同的用法吗?

When I run a shell bash I use #!/bin/bash. There is how to do the same with C#?

推荐答案

#!(hashbang)标记用于告诉shell使用哪个解释器,以便您的perl,php,bash,sh等脚本将正确运行.

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.

但是C#不是脚本语言,它旨在被编译成可执行格式.如果要使用C#,则至少需要安装编译器和运行时,最好是IDE(集成开发环境)来帮助您开发和调试应用程序.

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.

为编译器和运行时安装 Mono ,然后 MonoDevelop .

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

更多推荐

在Linux终端上运行C#代码

本文发布于:2023-11-16 04:28:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1600984.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:终端   代码   Linux

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!