【转】[C#] 预处理指令

#define and #undef

用法:

#define DEBUG

#undef DEBUG

 

#if , #elif , #else , and #endif

用法:

#if DEBUG

#endif

 

#warning and #error

用法:

#if DEBUG && RELEASE

#error "You've defined DEBUG AND RELEASE simultaneously!"

#endif

#warning "Don't forget to remove this line before the boss tests the code!"

 

#region and #endregion

用法:

#region Member Field Declarations

xx

#endregion

 

#line

用法:

#line 164 "Core.cs"

#line default

 

#pragma

用法:

#pragma warning disable 169

xxx

#pragma warning restore 169

 

#nullable

用法:

#nullable enable

#nullable disable

#nullable restore

 

posted on 2025-07-25 14:34  z5337  阅读(7)  评论(0)    收藏  举报