#undef डायरेक्टिव आपको एक सिंबल को अनडिफाइन करने की अनुमति देता है। सिंटैक्स निम्नलिखित है:
#undef SYMBOL
उदाहरण के लिए:
#undef One
जब #if डायरेक्टिव के साथ उपयोग किया जाता है तो यह false का मूल्यांकन करता है। आइए एक उदाहरण देखें:
उदाहरण
#define One #undef Two using System; namespace Demo { class Program { static void Main(string[] args) { #if (One && TWO) Console.WriteLine("Both are defined"); #elif (ONE && !TWO) Console.WriteLine("ONE is defined and TWO is undefined"); #elif (!ONE && TWO) Console.WriteLine("ONE is defined and TWO is undefined"); #else Console.WriteLine("Both are undefined"); #endif } } }आउटपुट
Both are undefined