#undef निर्देश आपको किसी प्रतीक को अपरिभाषित करने की अनुमति देता है। निम्नलिखित वाक्य रचना है -
#undef SYMBOL
उदाहरण के लिए,
#undef One
#if निर्देश के साथ उपयोग किए जाने पर यह असत्य का मूल्यांकन करता है। आइए एक उदाहरण देखें -
उदाहरण
#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