#if !USING_NET11 using System.Runtime.InteropServices.ComTypes; 是什么意思? #endif是什么意思?
下面的代码是什么意思以及它的作用是什么?真的需要吗?
#if !USING_NET11
using System.Runtime.InteropServices.ComTypes;
#endif
在我的项目文件中,我使用 dshownet 包装器实现了网络摄像头捕获。上面的代码位于 Form1.cs 文件中。
What does the following code mean and what does it do? Is it really required?
#if !USING_NET11
using System.Runtime.InteropServices.ComTypes;
#endif
In my project file I have implemented the web cam capture using the dshownet wrapper. The above code was there in the Form1.cs file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这意味着:
仅当符号 USING_NET11 为 false 时才会编译到程序集中。
由于 System.Runtime.InteropServices.ComTypes 是在 .NET 2.0 中添加的,因此该指令意味着代码仍将针对 .NET 1.1 进行编译,因为不会编译新引用。
It means that:
will only be compiled into the assembly if the symbol USING_NET11 is false.
Since System.Runtime.InteropServices.ComTypes was added in .NET 2.0, this directive means that the code will still compile against .NET 1.1 since the new reference won't be compiled in.
System.Runtime.InteropServices.ComType
是在 .NET Framework 2.0 版中引入的。该代码似乎试图与框架的 1.1 版本兼容,方法是仅在该命名空间上声明using
语句(如果要编译的版本不是 1.1)。如果您在 USING_NET11 上进行 Google 搜索 ,您会发现它指向许多托管 DirectX 代码。
The
System.Runtime.InteropServices.ComType
was introduced in .NET Framework version 2.0. The code appears to be attempting to be compatible with the 1.1 version of the framework by only declaring theusing
statement on that namespace if the version being compiled against isn't 1.1.If you do a Google search on USING_NET11, you'll find it points to a lot of managed DirectX code.