PrimaryInteropAssemblyAttribute 類別

定義

表示屬性化元件是主要 Interop 元件。

public ref class PrimaryInteropAssemblyAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
public sealed class PrimaryInteropAssemblyAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)]
public sealed class PrimaryInteropAssemblyAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class PrimaryInteropAssemblyAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)>]
type PrimaryInteropAssemblyAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)>]
type PrimaryInteropAssemblyAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type PrimaryInteropAssemblyAttribute = class
    inherit Attribute
Public NotInheritable Class PrimaryInteropAssemblyAttribute
Inherits Attribute
繼承
PrimaryInteropAssemblyAttribute
屬性

備註

你可以將此屬性套用到組合語言,雖然 Tlbimp.exe(類型庫匯入器)通常在 匯入型別庫時會幫你套用。

互操作組件包含描述現有 COM 類型的元資料,這些類型通常已在 COM 類型庫中描述。 Tlbimp.exe 從 COM 型態函式庫產生互操作組件。 互通組件通常只包含元資料(不含程式碼)。 主要互通組件由與其描述的型別庫相同的出版商提供,並提供該型別庫所定義型別的官方定義。 主要互操作組件總是由其發佈者簽署,以確保唯一性。

你可以從型別庫產生主要互操作組件,方法如下:

若要在受管理原始碼中指定主要互操作組件,必須在設計時將 and System.Runtime.InteropServices.GuidAttribute 套用PrimaryInteropAssemblyAttribute到組件中。 GuidAttribute主互操作組件上識別該型式庫的LIBID,並PrimaryInteropAssemblyAttribute識別該組配為主要互操作組件的特定型別庫版本。 如果該組合是同一類型庫多個版本的主要互操作組件,則 PrimaryInteropAssemblyAttribute 可以多次出現。

使用型態庫中定義的型別時,務必參考該型別庫的主要互操作組合,而非重新匯入或重新定義型別本身。

建構函式

名稱 Description
PrimaryInteropAssemblyAttribute(Int32, Int32)

初始化該類別的新實例 PrimaryInteropAssemblyAttribute ,使用該組合語言作為主要互操作組件的類型庫的主版本號與次要版本號。

屬性

名稱 Description
MajorVersion

取得該組合體作為主要互操作組件的型別庫的主要版本號。

MinorVersion

取得該組合體作為主要互操作組合的型別庫次要版本號。

TypeId

在衍生類別中實作時,取得這個 Attribute的唯一標識碼。

(繼承來源 Attribute)

方法

名稱 Description
Equals(Object)

傳回值,這個值表示這個實例是否等於指定的物件。

(繼承來源 Attribute)
GetHashCode()

傳回這個實例的哈希碼。

(繼承來源 Attribute)
GetType()

取得目前實例的 Type

(繼承來源 Object)
IsDefaultAttribute()

在衍生類別中覆寫時,指出這個實例的值是否為衍生類別的預設值。

(繼承來源 Attribute)
Match(Object)

在衍生類別中覆寫時,傳回值,指出這個實例是否等於指定的物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

明確介面實作

名稱 Description
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。

(繼承來源 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取 物件的型別資訊,可用來取得介面的類型資訊。

(繼承來源 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。

(繼承來源 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開屬性和方法的存取權。

(繼承來源 Attribute)

適用於

另請參閱