Possible Duplicate:
How can I conditionally compile my C# for Mono vs. Microsoft .NET?
I’m writing code in C# that uses .NET reflection fairly aggressively, including some features that aren’t yet available in Mono. The easy way for me to handle this is with a small number of conditionals:
#if MONO
... stuff that works on mono ....
#else
... stuff that works on .NET 4.0 but not (yet) on mono ...
#endif
So here’s my question: are there any predefined flags I could test this way that either the Mono csharp compiler would have defined automatically, or if not, that the .NET csharp compiler predefines, that I can test this way?
It needs to be a compile-time test (I know how to determine the platform at runtime, but that would be too late)
Determining the platform at runtime is preferred thing to do. It’s not uncommon that program is compiled with Mono’s C# compiler and run on .NET (it’s even possible to run Mono’s C# compiler straight on .NET runtime).
__MonoCS__is intended for compiler workarounds only and should never be used to limit target platform.