Compartir a través de


Clase ComEventInterfaceAttribute

 

Publicado: octubre de 2016

Identifica la interfaz de origen y la clase que implementa los métodos de la interfaz de evento que se genera cuando se importa una coclase de una biblioteca de tipos COM.

Espacio de nombres:   System.Runtime.InteropServices
Ensamblado:  mscorlib (en mscorlib.dll)

Jerarquía de herencia

System.Object
  System.Attribute
    System.Runtime.InteropServices.ComEventInterfaceAttribute

Sintaxis

[AttributeUsageAttribute(AttributeTargets.Interface, Inherited = false)]
[ComVisibleAttribute(true)]
public sealed class ComEventInterfaceAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Interface, Inherited = false)]
[ComVisibleAttribute(true)]
public ref class ComEventInterfaceAttribute sealed : Attribute
[<Sealed>]
[<AttributeUsageAttribute(AttributeTargets.Interface, Inherited = false)>]
[<ComVisibleAttribute(true)>]
type ComEventInterfaceAttribute = 
    class
        inherit Attribute
    end
<AttributeUsageAttribute(AttributeTargets.Interface, Inherited := False)>
<ComVisibleAttribute(True)>
Public NotInheritable Class ComEventInterfaceAttribute
    Inherits Attribute

Constructores

Nombre Descripción
System_CAPS_pubmethod ComEventInterfaceAttribute(Type, Type)

Inicializa una nueva instancia de la ComEventInterfaceAttribute clase con la clase de proveedor de interfaz y el evento de origen.

Propiedades

Nombre Descripción
System_CAPS_pubproperty EventProvider

Obtiene la clase que implementa los métodos de la interfaz de eventos.

System_CAPS_pubproperty SourceInterface

Obtiene la interfaz de origen inicial de la biblioteca de tipos.

System_CAPS_pubproperty TypeId

Cuando se implementa en una clase derivada, obtiene un identificador único para este Attribute.(Heredado de Attribute).

Métodos

Nombre Descripción
System_CAPS_pubmethod Equals(Object)

Esta API admite la infraestructura producto y no está diseñada para usarse directamente desde el código. Devuelve un valor que indica si esta instancia es igual que un objeto especificado.(Heredado de Attribute).

System_CAPS_pubmethod GetHashCode()

Devuelve el código hash de esta instancia.(Heredado de Attribute).

System_CAPS_pubmethod GetType()

Obtiene el Type de la instancia actual.(Heredado de Object).

System_CAPS_pubmethod IsDefaultAttribute()

Si se reemplaza en una clase derivada, indica si el valor de esta instancia es el valor predeterminado de la clase derivada.(Heredado de Attribute).

System_CAPS_pubmethod Match(Object)

Cuando se invalida en una clase derivada, devuelve un valor que indica si esta instancia es igual a un objeto especificado.(Heredado de Attribute).

System_CAPS_pubmethod ToString()

Devuelve una cadena que representa el objeto actual.(Heredado de Object).

Implementaciones de interfaz explícitas

Nombre Descripción
System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Asigna un conjunto de nombres a un conjunto correspondiente de identificadores de envío.(Heredado de Attribute).

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Obtiene la información de tipos de un objeto, que puede utilizarse para obtener la información de tipos de una interfaz.(Heredado de Attribute).

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetTypeInfoCount(UInt32)

Recupera el número de interfaces de información de tipo que proporciona un objeto (0 ó 1).(Heredado de Attribute).

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Proporciona acceso a las propiedades y los métodos expuestos por un objeto.(Heredado de Attribute).

Comentarios

You can apply this attribute to interfaces, although the [<topic://cpgrfTypeLibraryImporterTlbimpexe>] typically applies it for you when it imports a type library.

When a source interface is imported from a type library, any methods it implements are added as events to a generated event interface. Tlbimp.exe applies T:System.Runtime.InteropServices.ComEventInterfaceAttribute to the event interface to identify the managed class that implements the methods of the event interface and implements the original source interface. The common language runtime uses this attribute at run time to perform the following tasks:

  • Associate events exposed by the interface to their implementation in the event provider class.

  • Link the events to the original COM source interface.

You rarely apply this attribute. However, if you plan to write source code that produces metadata that closely simulates metadata produced by Tlbimp.exe, you should create a event interface for each original source interface. For a detailed description about how Tlbimp.exe imports events, see Imported Member Conversion. For instruction about how to expose a COM event to a.NET client, see How to: Handle Events Raised by a COM Source.

Información de versión

Plataforma universal de Windows
Disponible desde 8
.NET Framework
Disponible desde 1.1
Biblioteca de clases portable
Se admite en: plataformas portátiles de .NET
Windows Phone
Disponible desde 8.1

Seguridad para subprocesos

Cualquier miembro ( Compartido en Visual Basic) estático público de este tipo es seguro para subprocesos. No se garantiza que los miembros de instancia sean seguros para subprocesos.

Ver también

Espacio de nombres System.Runtime.InteropServices
Tlbimp.exe (Type Library Importer)

Volver al principio