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> (Visual Basic 中的MyGenericType(Of Integer)),則這個屬性的值是由 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.