You have the regular #if and #else preprocessor directive inside which you could place your code. Take a look at the ‘C# Preprocessor Directives’ section for the complete list of preprocessor directives.
There is also a concept of ‘Conditonal Methods’ that will let you declare some methods as conditional methods based on the presence of certain preprocessor directives, using the ConditionalAttribute. Then the compiler will not only ignore the method, but also the method-call if the preprocessor symbol is not defined. Take a look at this MSDN section for more information: