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 连接点的事件接口。 事件接口包含映射到 类的事件成员的方法。 类事件名称和接口方法名称必须相同。 通过将源接口的类型传递给适当的构造函数(采用一到四个类型参数),此属性最多可以容纳类的四个源接口。 对于想要公开四个以上源接口的类,可以使用构造函数的字符串版本。 有关向 COM 客户端 exposing.NET 事件的其他信息,请参阅 如何:引发 COM 接收器处理的事件

构造函数

ComSourceInterfacesAttribute(String)
已过时.

使用事件源接口名称初始化 ComSourceInterfacesAttribute 类的新实例。

ComSourceInterfacesAttribute(Type)
已过时.

使用要用作源接口的类型初始化 ComSourceInterfacesAttribute 类的新实例。

ComSourceInterfacesAttribute(Type, Type)
已过时.

使用要用作源接口的类型初始化 ComSourceInterfacesAttribute 类的新实例。

ComSourceInterfacesAttribute(Type, Type, Type)
已过时.

使用要用作源接口的类型初始化 ComSourceInterfacesAttribute 类的新实例。

ComSourceInterfacesAttribute(Type, Type, Type, Type)
已过时.

使用要用作源接口的类型初始化 ComSourceInterfacesAttribute 类的新实例。

属性

TypeId
已过时.

在派生类中实现时,获取此 Attribute 的唯一标识符。

(继承自 Attribute)
Value
已过时.

获取事件源接口的完全限定名。

方法

Equals(Object)
已过时.

返回一个值,该值指示此实例是否与指定的对象相等。

(继承自 Attribute)
GetHashCode()
已过时.

返回此实例的哈希代码。

(继承自 Attribute)
GetType()
已过时.

获取当前实例的 Type

(继承自 Object)
IsDefaultAttribute()
已过时.

在派生类中重写时,指示此实例的值是否是派生类的默认值。

(继承自 Attribute)
Match(Object)
已过时.

当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。

(继承自 Attribute)
MemberwiseClone()
已过时.

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()
已过时.

返回表示当前对象的字符串。

(继承自 Object)

显式接口实现

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)
已过时.

将一组名称映射为对应的一组调度标识符。

(继承自 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)
已过时.

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。

(继承自 Attribute)
_Attribute.GetTypeInfoCount(UInt32)
已过时.

检索对象提供的类型信息接口的数量(0 或 1)。

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)
已过时.

提供对某一对象公开的属性和方法的访问。

(继承自 Attribute)

适用于