This documentation is archived and is not being maintained.

ComImportAttribute Class

Indicates that the attributed type was previously defined in COM.

For a list of all members of this type, see ComImportAttribute Members.


[Visual Basic]
<AttributeUsage(AttributeTargets.Class Or _
NotInheritable Public Class ComImportAttribute
   Inherits Attribute
[AttributeUsage(AttributeTargets.Class |
public sealed class ComImportAttribute : Attribute
[AttributeUsage(AttributeTargets::Class |
public __gc __sealed class ComImportAttribute : public Attribute
   AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)
class ComImportAttribute extends Attribute

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


You can apply this attribute to classes or interfaces, although the Type Library Importer (Tlbimp.exe) typically applies it for you when it imports a type library.

ComImportAttribute is a pseudo-custom attribute that indicates that a type has been defined in a previously published type library. The common language runtime treats these types differently when activating, exporting, coercing, and so on.

A pseudo-custom attribute indicates that bits of the core metadata of a type need to be set when the attribute is present. Unlike a custom attribute that extends the metadata for a type and is saved along with the type, a pseudo-custom attribute modifies the metadata for the type and is discarded.


Namespace: System.Runtime.InteropServices

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

See Also

ComImportAttribute Members | System.Runtime.InteropServices Namespace | Type Library Importer (Tlbimp.exe)