Type.IsCOMObject 属性


获取一个值,通过该值指示 Type 是否为 COM 对象。Gets a value indicating whether the Type is a COM object.

 property bool IsCOMObject { bool get(); };
public bool IsCOMObject { get; }
member this.IsCOMObject : bool
Public ReadOnly Property IsCOMObject As Boolean


如果 true 为 COM 对象,则为 Type;否则为 falsetrue if the Type is a COM object; otherwise, false.



此方法返回 COM 接口 false,因为它们不是对象。This method returns false for COM interfaces because they are not objects. COM 接口可由 Microsoft .NET Framework 对象实现。COM interfaces can be implemented by Microsoft .NET Framework objects.

还可以通过使用tlbimp.exe (类型库导入程序)工具加载 com 类并获取该 com 类的 Type 对象。You can also load a COM class and get a Type object for that COM class by using the Tlbimp.exe (Type Library Importer) tool.

如果当前 Type 表示构造泛型类型,则此属性应用于构造该类型的泛型类型定义。If the current Type represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. 例如,如果当前 Type 表示 MyGenericType<int> (MyGenericType(Of Integer) Visual Basic),则此属性的值由 MyGenericType<T>确定。For example, if the current Type represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

如果当前 Type 表示泛型类型或泛型方法的定义中的类型参数,则此属性始终返回 falseIf the current Type represents a type parameter in the definition of a generic type or generic method, this property always returns false.