ComSourceInterfacesAttribute 類別

定義

警告

ComSourceInterfacesAttribute may be unavailable in future releases.

識別公開為屬性類別之 COM 事件來源的介面清單。

public ref class ComSourceInterfacesAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)]
[System.Obsolete("ComSourceInterfacesAttribute may be unavailable in future releases.")]
public sealed class ComSourceInterfacesAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)]
public sealed class ComSourceInterfacesAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, Inherited=false)]
public sealed class ComSourceInterfacesAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ComSourceInterfacesAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)>]
[<System.Obsolete("ComSourceInterfacesAttribute may be unavailable in future releases.")>]
type ComSourceInterfacesAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)>]
type ComSourceInterfacesAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, Inherited=false)>]
type ComSourceInterfacesAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ComSourceInterfacesAttribute = class
    inherit Attribute
Public NotInheritable Class ComSourceInterfacesAttribute
Inherits Attribute
繼承
ComSourceInterfacesAttribute
屬性

範例

以下範例展示了如何透過傳遞命名空間與事件匯入介面,將事件匯入介面與類別連接 ComSourceInterfacesAttribute

using namespace System::Runtime::InteropServices;

[ComSourceInterfacesAttribute("ButtonEventsLib.ButtonEvents, ButtonEventsLib")]
public ref class Baz{};
using System.Runtime.InteropServices;

[ComSourceInterfacesAttribute("ButtonEventsLib.ButtonEvents, ButtonEventsLib")]
public class Baz
{
   //Insert code here.
}
Imports System.Runtime.InteropServices

<ComSourceInterfacesAttribute("ButtonEventsLib.ButtonEvents, ButtonEventsLib")> _
public Class Baz
    'Insert code here.
End Class

備註

你可以把這個屬性套用到職業上。

你可以將此屬性套用到受管理類別,以識別該類別暴露為 COM 連接點的事件介面。 事件介面包含映射到類別事件成員的方法。 類別事件名稱與介面方法名稱必須相同。 此屬性可容納最多四個類別的原始碼介面,方法是將原始碼介面的類型傳遞給適當的建構子,該建構子會包含一到四個型別參數。 對於想要暴露超過四個原始碼介面的類別,可以使用建構子的字串版本。

建構函式

名稱 Description
ComSourceInterfacesAttribute(String)
已淘汰.

初始化一個新的類別實例 ComSourceInterfacesAttribute ,並以事件來源介面的名稱。

ComSourceInterfacesAttribute(Type, Type, Type, Type)
已淘汰.

初始化一個新的類別實例 ComSourceInterfacesAttribute ,並使用用作原始碼介面的型別。

ComSourceInterfacesAttribute(Type, Type, Type)
已淘汰.

初始化一個新的類別實例 ComSourceInterfacesAttribute ,並使用用作原始碼介面的型別。

ComSourceInterfacesAttribute(Type, Type)
已淘汰.

初始化一個新的類別實例 ComSourceInterfacesAttribute ,並使用用作原始碼介面的型別。

ComSourceInterfacesAttribute(Type)
已淘汰.

初始化一個新的類別實例 ComSourceInterfacesAttribute ,並以用作原始碼介面的型別。

屬性

名稱 Description
TypeId
已淘汰.

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

(繼承來源 Attribute)
Value
已淘汰.

取得事件來源介面的完整限定名稱。

方法

名稱 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)

適用於