#warning 使您得以从代码的特定位置生成一级警告。例如:
#warning Deprecated code in this method.
#warning 通常用在条件指令中。也可以用 #error(C# 参考)生成用户定义的错误。
// preprocessor_warning.cs // CS1030 expected #define DEBUG class MainClass { static void Main() { #if DEBUG #warning DEBUG is defined #endif } }