This question already has an answer here:
I need to dual-compile a class library for Mono on the Mac and .NET on the PC. There are some minor changes I want to make, but I was hoping to split the code using a compiler directive. Any suggestions?
This question already has an answer here:
I need to dual-compile a class library for Mono on the Mac and .NET on the PC. There are some minor changes I want to make, but I was hoping to split the code using a compiler directive. Any suggestions?
Well you could certainly use
and then compile with
(Or put it in your Mono build configuration, of course. It really depends on how you're building your library.)
... what are you looking for beyond that?
While a runtime check is probably preferable, with the Mono compiler, the pre-defined
__MonoCS__
constant is useful, e.g.:Preferred way is to use runtime detection, as this allows for the same assemblies to be used on either platform: