ComEventInterfaceAttribute 类   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注意
ComEventInterfaceAttribute may be unavailable in future releases.
标识源接口和实现事件接口方法的类,事件接口在从 COM 类型库中导入组件类时生成。
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 AttributePublic NotInheritable Class ComEventInterfaceAttribute
Inherits Attribute- 继承
- 属性
注解
可以将此属性应用于接口,但 Tlbimp.exe (类型库导入程序) 通常在导入类型库时为你应用此属性。
从类型库导入源接口时,它实现的任何方法都会作为事件添加到生成的事件接口。 Tlbimp.exe 应用于 ComEventInterfaceAttribute 事件接口,以标识实现事件接口的方法并实现原始源接口的托管类。 公共语言运行时在运行时使用此属性来执行以下任务:
- 将接口公开的事件与其在事件提供程序类中的实现相关联。 
- 将事件链接到原始 COM 源接口。 
很少应用此属性。 但是,如果计划编写源代码,以生成密切模拟 Tlbimp.exe 生成的元数据的元数据,则应为每个原始源接口创建一个事件接口。 有关 Tlbimp.exe 导入事件的详细说明,请参阅 导入的成员转换。 有关如何向 .NET 客户端公开 COM 事件的说明,请参阅 如何:处理 COM 源引发的事件。
构造函数
| 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) |