NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

comimport

Marks a class as being an externally implemented COM coclass.

[comimport]

Applies To

Class declarations.

Remarks

comimport is a single-use attribute. comimport is an alias for System.InterOp.ComImportAttribute.

A class with the comimport attribute must also have a guid attribute. A comimport class must be derived directly from object and must not have any members. Creating an instance of a comimport class using new is equivalent to calling CoCreateInstance.

Example

[comimport, guid("E436EBB3-524F-11CE-9F53-0020AF0BA770")] 
class FilgraphManager 
{ 
    // cannot have any members here 
    // NOTE: the C# compiler will add a default parameterless
       constructor 
}
class MainClass 
{ 
    public static void Main() 
    { 
        // Create an instance of a COM classic coclass - calls
        // CoCreateInstance(E436EBB3-524F-11CE-9F53-0020AF0BA770, 
        //                  NULL, CLSCTX_ALL, 
        //                  IID_IUnknown, &f) 
        // returns null on failure. 
        FilgraphManager f = new FilgraphManager(); 
    } 
}

See Also

C# Attributes | COM InterOp Tutorial