Emulator compiler directive

I’m working on some UI code that can be done just fine in the emulator, in fact it would be quicker to debug and run. Rather than comment out my hardware-specific code is there a way to use the standard C# compilier directives to detect if the target is the Microsoft Emulator?

Something like:

#if EMULATOR 
            doWork();
 #else
            doOtherWork();
 #endif

Thanks,
Bob

I think it should work. Try it.

You’d have to do it yourself, because (if I understand correctly) the compiler doesn’t know what the target is, unless you tell it (by setting the #define in project properties).

I had forgotten a bit about how the preprocessor symbols work. I simply just checked the Define DEBUG constant checkbox and then set that configuration to use the emulator. The release configuration uses the actual hardware. Then in the code I just check the DEBUG constant.

#if DEBUG 
            doWork();
 #else
            doOtherWork();
 #endif