开发者

What does #if !USING_NET11 using System.Runtime.InteropServices.ComTypes; #endif mean?

开发者 https://www.devze.com 2023-01-05 07:35 出处:网络
What does the following code mean and what does it do? Is it really required? #if !USING_NET11 using System.Runtime.InteropServices.ComTypes;

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 ca开发者_JS百科pture using the dshownet wrapper. The above code was there in the Form1.cs file.


It means that:

using System.Runtime.InteropServices.ComTypes;

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.


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 the using 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号