【发布时间】:2011-03-09 18:24:24
【问题描述】:
以下代码是什么意思,它有什么作用?真的需要吗?
#if !USING_NET11
using System.Runtime.InteropServices.ComTypes;
#endif
在我的项目文件中,我使用 dshownet 包装器实现了网络摄像头捕获。上面的代码在 Form1.cs 文件中。
【问题讨论】:
标签: runtime system interopservices comtypes
以下代码是什么意思,它有什么作用?真的需要吗?
#if !USING_NET11
using System.Runtime.InteropServices.ComTypes;
#endif
在我的项目文件中,我使用 dshownet 包装器实现了网络摄像头捕获。上面的代码在 Form1.cs 文件中。
【问题讨论】:
标签: runtime system interopservices comtypes
意思是:
using System.Runtime.InteropServices.ComTypes;
仅当符号 USING_NET11 为 false 时才会编译到程序集中。
由于 System.Runtime.InteropServices.ComTypes 是在 .NET 2.0 中添加的,因此该指令意味着代码仍将针对 .NET 1.1 进行编译,因为不会在其中编译新的引用。
【讨论】:
System.Runtime.InteropServices.ComType 是在 .NET Framework 2.0 版中引入的。代码似乎试图与框架的 1.1 版本兼容,如果编译的版本不是 1.1,则仅在该命名空间上声明 using 语句。
如果您执行Google search on USING_NET11,您会发现它指向很多托管 DirectX 代码。
【讨论】: