Within the body of an #if/#endif pair, you can include #define or #undef directives. If the body of the #if does contain#define or #undef directives, it must appear before the first token of the containing source file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #define DOGSBARK #if DOGSBARK || DOGSGROWL #define DOGSMAKENOISE #endif using System; using DogLibrary; namespace ConsoleApplication1 { class Program { static void Main() { Dog d = new Dog( "Kirby" , 12); #if DOGSMAKENOISE d.BarkOrGrowl(); #endif } } } |