[Mono-list] Can I decide mono compiler is used with #if ?

Chris Howie cdhowie at gmail.com
Tue Nov 25 12:45:06 EST 2008

On Mon, Nov 24, 2008 at 10:06 PM, chenxing <cxcxcxcx at gmail.com> wrote:
> I am curious about if Mono C# compiler defines some symbols so that I can
> check if the compiler is Mono or .Net with #if.

Yes, mcs defines the __MonoCS__ symbol.  Note that this does not tell
you the runtime environment, as mcs-compiled executables can be run on
Windows, and csc executables can be run on Mono.  So you should have a
very good reason for testing for __MonoCS__.

Chris Howie

More information about the Mono-list mailing list