简体   繁体   中英

what are advantages and limitations of using mono project to run c# code on linux?

如果有人在Linux上运行C#Code使用mono项目的优势和局限性解决方案,请告诉我你的想法......

There's a huge advantage - it works. You can use C#, develop, and run on Linux (and other platforms, including Windows).

The disadvantage is that things don't always work the same way as they do in MS's .NET implementation, and there is some functionality that is not implemented at all, such as WPF.

Advantages

  • Investment - when you choose right software you don't have to pay for software licences when running Mono on Linux (this doesn't mean that it's free - Linux is only free if your time has no value).
  • No vendor lock-in - you have more choices for other software on Linux (for example DB or Web servers) when compared to MS solutions which works best with other MS stuff.
  • Mono specific libraries (for example Mono.Simd or REPL).
  • Open source (you, or others, can fix bugs/provide patches/improve code by yourself).

Limitations

  • Incompatibility with MS.NET framework.
  • In general you will probably spent more time with certain things (for example dealing with incompatibility or learning Linux administration and such).
  • Mono is not up-to-date with new API and features for some time when new version of .NET framework is released.

I have developed a few apps in C# and have tried to get a few running on Linux via Mono. Getting console applications to run in pretty simple. Most of the time, there is no code change needed to get these types of applications running under Mono. However, GUI applications are always more tricky. The first thing you should know is that your user interface will not blend in with the user's theme. The application will always look like a Windows 98 application, assuming you are using Microsoft's System.Windows.Forms.

If, however, you plan to write and run the application only on Linux, then you could use Mono's Gtk# to build the user interface. This integrates with Linux desktops much better than System.Windows.Forms. This page gives a good rundown of the different GUI toolkits, their pros, and their cons.

If you are sticking with System.Windows.Forms for the GUI toolkit in order to run your application on both Windows and Linux, keep in mind that even though Mono supports C# 4.0, you are better off keeping yourself limited to C# 2.0, as some of the features of 3.0 and up aren't implemented or do not work well on Linux.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM