c# - c# pragma 指令的范围是什么

标签 c#

<分区>

C# 编译器指令(例如#pragma)的范围是什么?这样的指令应该在哪里声明,它在哪里生效?

C# 规范在这一点上有些含糊。

最佳答案

the documentation中的第一行很清楚:

#pragma gives the compiler special instructions for the compilation of the file in which it appears.

所以它只与指令所在的文件有关。如果你把指令放在一半,它会应用到下半部分。

关于c# - c# pragma 指令的范围是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40044067/

相关文章:

c# - 在 C# 中读取 Excel 文件时如何修复 "Not a legal OleAut date."?

C# Webbrowser Onclick Javascript 事件处理

c# - 从 xml 文件中删除独立属性

c# - Youtube Api 获取 channel 上的所有视频(不再可用错误)

c# - 是否有任何 html5 .Net 绑定(bind)框架

c# - WP8 : Fast app resume + secondary tile + MainPage = 2 instances

c# - 图像处理循环中的内存异常(需要比 GC.collect 更好的解决方案)

c# - Nunit 未在测试项目类库 (VS2012) 中遇到断点

c# - Cosmos DB - ExecuteNextAsync 返回空对象

c# - 简洁的 LINQ to XML 查询