문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top