关于C#的接口实例化

 

why can we create instance for a Interface like this?

Interface Type{……}

Type pType = new Type();

__________________________________________________

OK,For this example,u should find the COM interop code like this.

[ComImport] [Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352")]

These are so called attributes. They usually emit metadata about a class, a class member or an assembly which is then used by the JIT compiler, CLR or even in other parts of the program. In your particular example, the attributes instruct the runtime to forward calls to the class that apply to a COM object with the specified GUID and interface type.

你可能感兴趣的:(C#学习笔记)