Attributes for Importing Type Libraries into Interop Assemblies
The .NET Framework's COM interoperability mechanism provides four custom type library attributes to control the importation of type libraries into interop assemblies using the Type Library Importer (Tlbimp.exe). These custom attributes help keep type libraries in sync with the primary interop assemblies. They also allow backward compatibility with the functionality of Microsoft Visual Basic versions 5.0 and 6.0 without having to change interface definitions.
Note |
---|
Use these custom attributes only if you are unable to change the definitions in your Interface Definition Language (IDL) file. The preferred method in such situations, if possible, is to make the fix in the IDL rather than use the custom attributes. |
These custom attributes enable you to perform the following operations:
Use custom(B64784EB-D8D4-4d9b-9ACD-0E30806426F7,"") to force your interface to implement IEnumerable. See Applying the custom Attribute to Implement IEnumerable for an example.
Use custom(CD2BC5C9-F452-4326-B714-F9C539D4DA58, 0), id(2), helpstring("method method1") to overwrite the previous dispatch identifier (DISPID) of an interface. See Applying the custom Attribute to Overwrite the Default COM Dispatch Identifier (DISPID) for an example.
Use custom(2941ff83-88d8-4f73-b6a9-bdf8712d000d, ""), id(6) to tag a method as propget without changing the signature in the type library. See Applying the custom Attribute to Tag Unmanaged COM Get/Set Properties for an example.
Use custom(29533527-3683-4364-abc0-db1add822fa2, ""), id(7) to tag a method as propput without changing the signature in the type library. See Applying the custom Attribute to Tag Unmanaged COM Get/Set Properties for an example.
See Also
Reference
Tlbimp.exe (Type Library Importer)
Concepts
Applying the custom Attribute to Implement IEnumerable
Applying the custom Attribute to Overwrite the Default COM Dispatch Identifier (DISPID)
Applying the custom Attribute to Tag Unmanaged COM Get/Set Properties