Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Reflection.​EventInfo

Assembly: System.Runtime

Inheritance: object → MemberInfo → EventInfo

Discovers the attributes of an event and provides access to event metadata.

Properties

public MethodInfo
AddMethod
Gets the <see cref="T:System.Reflection.MethodInfo" /> object for the <see cref="M:System.Reflection.EventInfo.AddEventHandler(System.Object,System.Delegate)" /> method of the event, including non-public methods.
Attributes
Gets the attributes for this event.
public Type
EventHandlerType
Gets the <see langword="Type" /> object of the underlying event-handler delegate associated with this event.
public bool
IsMulticast
Gets a value indicating whether the event is multicast.
public bool
IsSpecialName
Gets a value indicating whether the <see langword="EventInfo" /> has a name with a special meaning.
public MemberTypes
MemberType
Gets a <see cref="T:System.Reflection.MemberTypes" /> value indicating that this member is an event.
public MethodInfo
RaiseMethod
Gets the method that is called when the event is raised, including non-public methods.
public MethodInfo
RemoveMethod
Gets the <see langword="MethodInfo" /> object for removing a method of the event, including non-public methods.
CustomAttributes
Gets a collection that contains this member's custom attributes.
public Type
DeclaringType
Gets the class that declares this member.
public bool
IsCollectible
Gets a value that indicates whether this <see cref="T:System.Reflection.MemberInfo" /> object references one or more assemblies held in a collectible <see cref="T:System.Runtime.Loader.AssemblyLoadContext" /> .
public int
MetadataToken
Gets a value that identifies a metadata element.
public Module
Module
Gets the module in which the type that declares the member represented by the current <see cref="T:System.Reflection.MemberInfo" /> is defined.
public string
Name
Gets the name of the current member.
public Type
ReflectedType
Gets the class object that was used to obtain this instance of <see langword="MemberInfo" /> .

Methods

public void
AddEventHandler​(object target, delegate handler)
target The event source.
handler Encapsulates a method or methods to be invoked when the event is raised by the target.
Adds an event handler to an event source.
public bool
Equals​(object obj)
obj An object to compare with this instance, or <see langword="null" /> .
Returns <see langword="true" /> if <paramref name="obj" /> equals the type and value of this instance; otherwise, <see langword="false" /> .
Returns a value that indicates whether this instance is equal to a specified object.
public MethodInfo
GetAddMethod​()
Returns A <see cref="T:System.Reflection.MethodInfo" /> object representing the method used to add an event handler delegate to the event source.
Returns the method used to add an event handler delegate to the event source.
public MethodInfo
GetAddMethod​(bool nonPublic)
nonPublic <see langword="true" /> if non-public methods can be returned; otherwise, <see langword="false" /> .
Returns A <see cref="T:System.Reflection.MethodInfo" /> object representing the method used to add an event handler delegate to the event source.
When overridden in a derived class, retrieves the <see langword="MethodInfo" /> object for the <see cref="M:System.Reflection.EventInfo.AddEventHandler(System.Object,System.Delegate)" /> method of the event, specifying whether to return non-public methods.
public int
GetHashCode​()
Returns A 32-bit signed integer hash code.
Returns the hash code for this instance.
public MethodInfo[]
GetOtherMethods​()
Returns An array representing the public methods that have been associated with the event in metadata by using the <see langword=".other" /> directive. If there are no such public methods, an empty array is returned.
Returns the public methods that have been associated with an event in metadata using the <see langword=".other" /> directive.
public MethodInfo[]
GetOtherMethods​(bool nonPublic)
nonPublic <see langword="true" /> to include non-public methods; otherwise, <see langword="false" /> .
Returns An array representing methods that have been associated with an event in metadata by using the <see langword=".other" /> directive. If there are no methods matching the specification, an empty array is returned.
Returns the methods that have been associated with the event in metadata using the <see langword=".other" /> directive, specifying whether to include non-public methods.
public MethodInfo
GetRaiseMethod​()
Returns The method that is called when the event is raised.
Returns the method that is called when the event is raised.
public MethodInfo
GetRaiseMethod​(bool nonPublic)
nonPublic <see langword="true" /> if non-public methods can be returned; otherwise, <see langword="false" /> .
Returns A <see langword="MethodInfo" /> object that was called when the event was raised.
When overridden in a derived class, returns the method that is called when the event is raised, specifying whether to return non-public methods.
public MethodInfo
GetRemoveMethod​()
Returns A <see cref="T:System.Reflection.MethodInfo" /> object representing the method used to remove an event handler delegate from the event source.
Returns the method used to remove an event handler delegate from the event source.
public MethodInfo
GetRemoveMethod​(bool nonPublic)
nonPublic <see langword="true" /> if non-public methods can be returned; otherwise, <see langword="false" /> .
Returns A <see cref="T:System.Reflection.MethodInfo" /> object representing the method used to remove an event handler delegate from the event source.
When overridden in a derived class, retrieves the <see langword="MethodInfo" /> object for removing a method of the event, specifying whether to return non-public methods.
public void
RemoveEventHandler​(object target, delegate handler)
target The event source.
handler The delegate to be disassociated from the events raised by target.
Removes an event handler from an event source.
public object[]
GetCustomAttributes​(bool inherit)
Inherited from MemberInfo
inherit <see langword="true" /> to search this member's inheritance chain to find the attributes; otherwise, <see langword="false" /> . This parameter is ignored for properties and events.
Returns An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined.
When overridden in a derived class, returns an array of all custom attributes applied to this member.
public object[]
GetCustomAttributes​(Type attributeType, bool inherit)
Inherited from MemberInfo
attributeType The type of attribute to search for. Only attributes that are assignable to this type are returned.
inherit <see langword="true" /> to search this member's inheritance chain to find the attributes; otherwise, <see langword="false" /> . This parameter is ignored for properties and events.
Returns An array of custom attributes applied to this member, or an array with zero elements if no attributes assignable to <paramref name="attributeType" /> have been applied.
When overridden in a derived class, returns an array of custom attributes applied to this member and identified by <see cref="T:System.Type" /> .
GetCustomAttributesData​()
Inherited from MemberInfo
Returns A generic list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the target member.
Returns a list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the target member.
public bool
HasSameMetadataDefinitionAs​(MemberInfo other)
Inherited from MemberInfo
public bool
IsDefined​(Type attributeType, bool inherit)
Inherited from MemberInfo
attributeType The type of custom attribute to search for. The search includes derived types.
inherit <see langword="true" /> to search this member's inheritance chain to find the attributes; otherwise, <see langword="false" /> . This parameter is ignored for properties and events.
Returns <see langword="true" /> if one or more instances of <paramref name="attributeType" /> or any of its derived types is applied to this member; otherwise, <see langword="false" /> .
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.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .
public string
ToString​()
Inherited from object
Returns A string that represents the current object.
Returns a string that represents the current object.