Preprocessor directives across different files in C#

后端 未结 4 1673
我在风中等你
我在风中等你 2020-12-06 11:00

I know that I can use preprocessor directives in C# to enable/disable compilation of some part of code.

If I define a directive in the same file, it wor

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-06 11:34

    There is no sense of applying #define on usings, as in this way you don't unlink from your project the libraries, that I suppose, you would like to avoid to reference in some condition.

    There is no such thing in .NET as conditional assemblies reference (if not done manually, dynamically).

    So the main point of use of preprocessor directives is just enable/disable parts of the code inside namespaces.

提交回复
热议问题