RegistrationServices.TypeRepresentsComType Method
Indicates whether a type is marked with the ComImportAttribute, or derives from a type marked with the ComImportAttribute and shares the same GUID as the parent.

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)

Syntax

Visual Basic (Declaration)
Public Overridable Function TypeRepresentsComType ( _
    type As Type _
) As Boolean
Visual Basic (Usage)
Dim instance As RegistrationServices
Dim type As Type
Dim returnValue As Boolean

returnValue = instance.TypeRepresentsComType(type)
C#
public virtual bool TypeRepresentsComType (
    Type type
)
C++
public:
virtual bool TypeRepresentsComType (
    Type^ type
)
J#
public boolean TypeRepresentsComType (
    Type type
)
JScript
public function TypeRepresentsComType (
    type : Type
) : boolean
XAML
Not applicable.

Parameters

type

The type to check for being a COM type.

Return Value

true if a type is marked with the ComImportAttribute, or derives from a type marked with the ComImportAttribute and shares the same GUID as the parent; otherwise false.
Platforms

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
See Also

Tags :


Community Content

DonS - MSFT
Related APIs

This returns true in three scenarios:

  1. A managed interface corresponding to a COM interface - The managed interface is marked with ComImportAttribute and a GuidAttribute with the UUID of the COM interface
  2. A managed interface corresponding to a COM coclass - When the Type Library Importer (tlbimp.exe) imports a COM coclass (say "Foo"), it creates a managed interface with the same name (ie. "Foo), and a managed class with the string "Class" appended (ie. "FooClass"). The managed interface is marked with ComImportAttribute, a Guid attribute with the CLSID of the COM coclass, and a CoClassAttribute pointing to the managed class. The managed class inherits from the managed interface, and has a Guid attribute with the CLSID of the COM coclass.
  3. A managed class inheriting from a managed interface marked with ComImportAttribute - This is "FooClass" above.

Related APIs are Type.IsCOMObject, Type.IsImport, Marshal.IsComObject.

Tags :

Page view tracker