ComEventInterfaceAttribute 类

定义

注意

ComEventInterfaceAttribute may be unavailable in future releases.

标识源接口和实现从 COM 类型库导入 coclass 时生成的事件接口的方法的类。

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

注解

可以将此属性应用于接口,尽管 Tlbimp.exe(类型库导入程序) 通常会在导入类型库时为你应用此属性。

从类型库导入源接口时,它实现的任何方法都作为事件添加到生成的事件接口。 Tlbimp.exe 适用于 ComEventInterfaceAttribute 事件接口,以标识实现事件接口的方法并实现原始源接口的托管类。 公共语言运行时在运行时使用此属性来执行以下任务:

  • 将接口公开的事件与事件提供程序类中的实现相关联。
  • 将事件链接到原始 COM 源接口。

很少应用此属性。 但是,如果计划编写生成元数据的源代码,以密切模拟 Tlbimp.exe生成的元数据,则应为每个原始源接口创建一个事件接口。

构造函数

名称 说明
ComEventInterfaceAttribute(Type, Type)
已过时.

使用源接口和事件提供程序类初始化类的新实例 ComEventInterfaceAttribute

属性

名称 说明
EventProvider
已过时.

获取实现事件接口方法的类。

SourceInterface
已过时.

从类型库获取原始源接口。

TypeId
已过时.

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

(继承自 Attribute)

方法

名称 说明
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)

适用于

另请参阅