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.

您也可以 Type 使用 Tlbimp.exe (型別程式庫匯入工具) 工具,載入 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 表示泛型型別或泛型方法定義中的類型參數,則這個屬性一律會傳回 falseIf the current Type represents a type parameter in the definition of a generic type or generic method, this property always returns false.