![]() ![]() You can use the operators = (equality) and != (inequality) to test for the bool values true or false. The following code is compiled when MYTEST is not defined: #if !MYTESTĬonsole.WriteLine("MYTEST is not defined") For example, the following code is compiled when DEBUG is defined: #if DEBUG The #if statement in C# is Boolean and only tests whether the symbol has been defined or not. Unlike C and C++, a numeric value to a symbol can't be assigned. ![]() The C# compiler compiles the code between the #if directive and #endif directive only if the specified symbol is defined, or not defined when the ! not operator is used. #endif: Closes the preceding conditional compilation.#else: Closes the preceding conditional compilation and opens a new conditional compilation if the previous specified symbol isn't defined.#elif: Closes the preceding conditional compilation and opens a new conditional compilation based on if the specified symbol is defined.#if: Opens a conditional compilation, where code is compiled only if the specified symbol is defined.You use four preprocessor directives to control conditional compilation: #nullable restore warnings: Restores the nullable warning context to project settings.#nullable enable warnings: Sets the nullable warning context to enabled.#nullable disable warnings: Sets the nullable warning context to disabled.#nullable restore annotations: Restores the nullable annotation context to project settings. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |