#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