Quick Tip: Windows Phone 7 Preprocessor Directive
- #Code Sample
- #Quick Tip
- #Silverlight
- #Windows Phone 7
- #wp7dev
- #XNA
If you’re sharing common code between Windows Phone 7 and other platforms in either Silverlight or XNA, then you may run into a need to fork some code based on the platform. This is normally done with a preprocessor directive, which for Windows Phone 7 is WINDOWS_PHONE.
#if WINDOWS_PHONE
// TODO:: WP7 specific code
#endif
It took me a while to find this, so for future reference know that you can always find this in the project’s properties panel:
