Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
231 views
in Technique[技术] by (71.8m points)

c# - Is developing in Mono cross-platform?

In what measure is developing with mono cross-platform? How do I compile for Windows (in Linux), how do I run things in Linux (because there is no .NET JIT compiler)?

So what are the particularities of developing with Mono? What are the advantages over developing with Visual Studio (except cross-platform thinghie)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Developing in Mono is definitely cross-platform with a caveat emptor:

  • Strive to steer clear of Windows specific APIs
  • No interoperability with the native Windows APIs... or... you can #ifdef out the Windows API and provide your own Mono wrapper in order to minimize code changes, for example, there's a DLL wrapper that uses Interop to invoke a Win32 method such as 'GetFont', this is a hypothetical example, GetFont will return the Font information, under Mono, that does not exist but however you can create a fake wrapper that returns nothing and incorporate the #ifdef macro to use the wrapper when compiling under Mono, and switch off the macro when compiling under Windows, how you implement the wrapper is up to you.
  • Do not use advanced GUI properties that may not be present in Mono.
  • Use the Environment property such as NewLine to make it independant of Unix's CR and Win32's CRLF, same apply for Path Separator, for Unix '/' and for Win32 ''.
  • Serialization is slightly different under Mono, you serialize an object on Mono, do not kid yourself into thinking it will be de-serialized under Win32 and vice versa.

Lastly but not least, keep checking from Mono to Win32 and back again, keep testing and testing it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...