ComSourceInterfacesAttribute 類別
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
警告
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 至 類別。
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
您可以將此屬性套用至類別。
您可以將此屬性套用至 Managed 類別,以識別類別公開為 COM 連接點的事件介面。 事件介面包含對應至 類別事件成員的方法。 類別事件名稱和介面方法名稱必須相同。 此屬性最多可容納類別的四個來源介面,方法是將來源介面的類型傳遞至適當的建構函式,這需要介於一到四個類型自變數之間。 對於想要公開四個以上來源介面的類別,可以使用建構函式的字串版本。 如需 COM 用戶端 exposing.NET 事件的詳細資訊,請參閱 如何:引發 COM 接收所處理的事件。
Com |
已淘汰.
使用事件來源介面的名稱,初始化 ComSourceInterfacesAttribute 類別的新執行個體。 |
Com |
已淘汰.
使用要當做來源介面使用的型別,初始化 ComSourceInterfacesAttribute 類別的新執行個體。 |
Com |
已淘汰.
使用要當做來源介面使用的型別,初始化 ComSourceInterfacesAttribute 類別的新執行個體。 |
Com |
已淘汰.
使用要當做來源介面使用的型別,初始化 |
Com |
已淘汰.
使用要當做來源介面使用的型別,初始化 ComSourceInterfacesAttribute 類別的新執行個體。 |
Equals(Object) |
已淘汰.
傳回值,這個值指出此執行個體是否與指定的物件相等。 (繼承來源 Attribute) |
Get |
已淘汰.
傳回這個執行個體的雜湊碼。 (繼承來源 Attribute) |
Get |
已淘汰.
取得目前執行個體的 Type。 (繼承來源 Object) |
Is |
已淘汰.
在衍生類別中覆寫時,表示這個執行個體的值是衍生類別的預設值。 (繼承來源 Attribute) |
Match(Object) |
已淘汰.
在衍生類別中覆寫時,會傳回值,表示這個執行個體是否等於指定物件。 (繼承來源 Attribute) |
Memberwise |
已淘汰.
建立目前 Object 的淺層複製。 (繼承來源 Object) |
To |
已淘汰.
傳回代表目前物件的字串。 (繼承來源 Object) |
_Attribute. |
已淘汰.
將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。 (繼承來源 Attribute) |
_Attribute. |
已淘汰.
擷取物件的類型資訊,可以用來取得介面的類型資訊。 (繼承來源 Attribute) |
_Attribute. |
已淘汰.
擷取物件提供的類型資訊介面數目 (0 或 1)。 (繼承來源 Attribute) |
_Attribute. |
已淘汰.
提供物件所公開的屬性和方法的存取權。 (繼承來源 Attribute) |
產品 | 版本 (已淘汰) |
---|---|
.NET | 5, 6, 7, 8, 9 (Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.1, 2.0 (1.2, 1.3, 1.4, 1.5, 1.6, 2.1) |
UWP | (10.0) |