ComAwareEventInfo Class

Definition

Caution

ComAwareEventInfo may be unavailable in future releases.

Permits late-bound registration of an event handler.

[System.Obsolete("ComAwareEventInfo may be unavailable in future releases.")]
public class ComAwareEventInfo : System.Reflection.EventInfo
public class ComAwareEventInfo : System.Reflection.EventInfo
Inheritance
ComAwareEventInfo
Attributes

Remarks

Normally, compilers will automatically embed calls to the ComAwareEventInfo.AddEventHandler(Object, Delegate) and ComAwareEventInfo.RemoveEventHandler(Object, Delegate) methods instead of using regular add handler and remove handler methods for events. This occurs if the interface that the corresponding event is defined on needs to be embedded.

You can specify this by embedding the entire assembly that contains the interface by using the /link option on the compilers or by setting the Embed Interop Types property to True in Visual Studio.

The ComAwareEventInfo type derives from the EventInfo class and overrides the EventInfo.AddEventHandler(Object, Delegate) and EventInfo.RemoveEventHandler(Object, Delegate) methods.

Constructors

ComAwareEventInfo(Type, String)

Initializes a new instance of the ComAwareEventInfo class by using the specified type and a name of the event on the type.

Properties

AddMethod

Gets the MethodInfo object for the AddEventHandler(Object, Delegate) method of the event, including non-public methods.

(Inherited from EventInfo)
Attributes

Gets the attributes for this event.

CustomAttributes

Gets a collection that contains this member's custom attributes.

(Inherited from MemberInfo)
DeclaringType

Gets the class that declares this member.

EventHandlerType

Gets the Type object of the underlying event-handler delegate associated with this event.

(Inherited from EventInfo)
IsCollectible

Gets a value that indicates whether this MemberInfo object is part of an assembly held in a collectible AssemblyLoadContext.

(Inherited from MemberInfo)
IsMulticast

Gets a value indicating whether the event is multicast.

(Inherited from EventInfo)
IsSpecialName

Gets a value indicating whether the EventInfo has a name with a special meaning.

(Inherited from EventInfo)
MemberType

Gets a MemberTypes value indicating that this member is an event.

(Inherited from EventInfo)
MetadataToken

Gets the metadata token associated with the current ComAwareEventInfo object.

MetadataToken

Gets a value that identifies a metadata element.

(Inherited from MemberInfo)
Module

Gets the module associated with the current ComAwareEventInfo object.

Module

Gets the module in which the type that declares the member represented by the current MemberInfo is defined.

(Inherited from MemberInfo)
Name

Gets the name of the current member.

RaiseMethod

Gets the method that is called when the event is raised, including non-public methods.

(Inherited from EventInfo)
ReflectedType

Gets the class object that was used to initialize this instance.

ReflectedType

Gets the class object that was used to obtain this instance of MemberInfo.

(Inherited from MemberInfo)
RemoveMethod

Gets the MethodInfo object for removing a method of the event, including non-public methods.

(Inherited from EventInfo)

Methods

AddEventHandler(Object, Delegate)

Attaches an event handler to a COM object.

Equals(Object)

Returns a value that indicates whether this instance is equal to a specified object.

(Inherited from EventInfo)
GetAddMethod()

Returns the method used to add an event handler delegate to the event source.

(Inherited from EventInfo)
GetAddMethod(Boolean)

Gets the method that was used to add an event handler delegate to the event source.

GetAddMethod(Boolean)

When overridden in a derived class, retrieves the MethodInfo object for the AddEventHandler(Object, Delegate) method of the event, specifying whether to return non-public methods.

(Inherited from EventInfo)
GetCustomAttributes(Boolean)

When overridden in a derived class, gets an array that contains all the custom attributes that are applied to this member.

GetCustomAttributes(Boolean)

When overridden in a derived class, returns an array of all custom attributes applied to this member.

(Inherited from MemberInfo)
GetCustomAttributes(Type, Boolean)

When overridden in a derived class, gets an array that contains all the custom attributes of the specified type that are applied to this member.

GetCustomAttributes(Type, Boolean)

When overridden in a derived class, returns an array of custom attributes applied to this member and identified by Type.

(Inherited from MemberInfo)
GetCustomAttributesData()

Returns a list of CustomAttributeData objects for the current ComAwareEventInfo.

GetCustomAttributesData()

Returns a list of CustomAttributeData objects representing data about the attributes that have been applied to the target member.

(Inherited from MemberInfo)
GetHashCode()

Returns the hash code for this instance.

(Inherited from EventInfo)
GetOtherMethods()

Returns the public methods that have been associated with an event in metadata using the .other directive.

(Inherited from EventInfo)
GetOtherMethods(Boolean)

Returns the public or non-public methods that have been associated with an event in metadata.

GetOtherMethods(Boolean)

Returns the methods that have been associated with the event in metadata using the .other directive, specifying whether to include non-public methods.

(Inherited from EventInfo)
GetRaiseMethod()

Returns the method that is called when the event is raised.

(Inherited from EventInfo)
GetRaiseMethod(Boolean)

When overridden in a derived class, returns the method that was called when the event was raised.

GetRaiseMethod(Boolean)

When overridden in a derived class, returns the method that is called when the event is raised, specifying whether to return non-public methods.

(Inherited from EventInfo)
GetRemoveMethod()

Returns the method used to remove an event handler delegate from the event source.

(Inherited from EventInfo)
GetRemoveMethod(Boolean)

When overridden in a derived class, retrieves the MethodInfo object for removing a method of the event.

GetRemoveMethod(Boolean)

When overridden in a derived class, retrieves the MethodInfo object for removing a method of the event, specifying whether to return non-public methods.

(Inherited from EventInfo)
GetType()

Discovers the attributes of a class event and provides access to event metadata.

(Inherited from EventInfo)
HasSameMetadataDefinitionAs(MemberInfo) (Inherited from MemberInfo)
IsDefined(Type, Boolean)

Indicates whether one or more instances of the specified attribute are applied to this member.

IsDefined(Type, Boolean)

When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member.

(Inherited from MemberInfo)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RemoveEventHandler(Object, Delegate)

Detaches an event handler from a COM object.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

_EventInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from EventInfo)
_EventInfo.GetType()

Returns a T:System.Type object representing the EventInfo type.

(Inherited from EventInfo)
_EventInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

Retrieves the type information for an object, which can then be used to get the type information for an interface.

(Inherited from EventInfo)
_EventInfo.GetTypeInfoCount(UInt32)

Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from EventInfo)
_EventInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Provides access to properties and methods exposed by an object.

(Inherited from EventInfo)
_MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from MemberInfo)
_MemberInfo.GetType()

Gets a Type object representing the MemberInfo class.

(Inherited from MemberInfo)
_MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

Retrieves the type information for an object, which can then be used to get the type information for an interface.

(Inherited from MemberInfo)
_MemberInfo.GetTypeInfoCount(UInt32)

Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from MemberInfo)
_MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Provides access to properties and methods exposed by an object.

(Inherited from MemberInfo)
ICustomAttributeProvider.GetCustomAttributes(Boolean)

Returns an array of all of the custom attributes defined on this member, excluding named attributes, or an empty array if there are no custom attributes.

(Inherited from MemberInfo)
ICustomAttributeProvider.GetCustomAttributes(Type, Boolean)

Returns an array of custom attributes defined on this member, identified by type, or an empty array if there are no custom attributes of that type.

(Inherited from MemberInfo)
ICustomAttributeProvider.IsDefined(Type, Boolean)

Indicates whether one or more instance of attributeType is defined on this member.

(Inherited from MemberInfo)

Extension Methods

GetCustomAttribute(MemberInfo, Type, Boolean)

Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttribute(MemberInfo, Type)

Retrieves a custom attribute of a specified type that is applied to a specified member.

GetCustomAttribute<T>(MemberInfo, Boolean)

Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttribute<T>(MemberInfo)

Retrieves a custom attribute of a specified type that is applied to a specified member.

GetCustomAttributes(MemberInfo, Boolean)

Retrieves a collection of custom attributes that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes(MemberInfo, Type, Boolean)

Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes(MemberInfo, Type)

Retrieves a collection of custom attributes of a specified type that are applied to a specified member.

GetCustomAttributes(MemberInfo)

Retrieves a collection of custom attributes that are applied to a specified member.

GetCustomAttributes<T>(MemberInfo, Boolean)

Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes<T>(MemberInfo)

Retrieves a collection of custom attributes of a specified type that are applied to a specified member.

IsDefined(MemberInfo, Type, Boolean)

Indicates whether custom attributes of a specified type are applied to a specified member, and, optionally, applied to its ancestors.

IsDefined(MemberInfo, Type)

Indicates whether custom attributes of a specified type are applied to a specified member.

GetAddMethod(EventInfo, Boolean)
GetAddMethod(EventInfo)
GetRaiseMethod(EventInfo, Boolean)
GetRaiseMethod(EventInfo)
GetRemoveMethod(EventInfo, Boolean)
GetRemoveMethod(EventInfo)
GetMetadataToken(MemberInfo)

Gets a metadata token for the given member, if available.

HasMetadataToken(MemberInfo)

Returns a value that indicates whether a metadata token is available for the specified member.

Applies to

Product Versions (Obsolete)
.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 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 (4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided))
.NET Standard 1.1, 2.0 (1.2, 1.3, 1.4, 1.5, 1.6, 2.1)
UWP (10.0)