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.



這個方法false會針對 COM 介面傳回,因為它們不是物件。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 (類型程式庫Type入工具)工具載入 com 類別,並取得該 com 類別的物件。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的表示泛型型別或泛型方法定義中的類型參數,則這個屬性false一律會傳回。If the current Type represents a type parameter in the definition of a generic type or generic method, this property always returns false.