Docs-.NET-C#-指南-语言参考-预处理器指令:#undef(C# 参考)

ylbtech-Docs-.NET-C#-指南-语言参考-预处理器指令:#undef(C# 参考)
1.返回顶部
1、

#undef(C# 参考)

#undef 允许你定义一个符号,这样一来,通过将该符号用作 #if 指令中的表达式,表达式将计算为 false

可使用 #define 指令或 -define 编译器选项来定义符号。 文件中必须先出现 #undef 指令,才能使用任何非指令的语句。

示例

C#
// preprocessor_undef.cs  
// compile with: /d:DEBUG  
#undef DEBUG  
using System;  
class MyClass
{  
    static void Main()
    {  
#if DEBUG  
        Console.WriteLine("DEBUG is defined");  
#else  
        Console.WriteLine("DEBUG is not defined");  
#endif  
    }  
}  

未定义 DEBUG

请参阅

2、
2.返回顶部
 
3.返回顶部
 
4.返回顶部
 
5.返回顶部
1、
2、
 
6.返回顶部
 
warn 作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/storebook/p/11836126.html