如果!使用System.Runtime.InteropServices.ComTypes使用_NET11#你的意思是什么?

如果!使用System.Runtime.InteropServices.ComTypes使用_NET11#你的意思是什么?,runtime,system,interopservices,comtypes,Runtime,System,Interopservices,Comtypes,下面的代码是什么意思?它的作用是什么?真的需要吗 #if !USING_NET11 using System.Runtime.InteropServices.ComTypes; #endif 在我的项目文件中,我使用dshownet包装器实现了webcam捕获。上述代码存在于Form1.cs文件中。在.NET Framework 2.0版中引入了System.Runtime.InteropServices.ComType。如果编译所依据的版本不是1.1,则代码似乎试图通过仅在该命名空间上

下面的代码是什么意思?它的作用是什么?真的需要吗

 #if !USING_NET11
 using System.Runtime.InteropServices.ComTypes;
 #endif

在我的项目文件中,我使用dshownet包装器实现了webcam捕获。上述代码存在于Form1.cs文件中。

在.NET Framework 2.0版中引入了
System.Runtime.InteropServices.ComType
。如果编译所依据的版本不是1.1,则代码似乎试图通过仅在该命名空间上使用语句声明
来与框架的1.1版本兼容

如果你做了一个测试,你会发现它指向很多托管DirectX代码。

这意味着:

using System.Runtime.InteropServices.ComTypes;
仅当使用_NET11的符号为false时,才会编译到程序集中

由于.NET 2.0中添加了System.Runtime.InteropServices.ComTypes,此指令意味着代码仍将根据.NET 1.1进行编译,因为新引用不会在中编译