Class EventBase<THandler>
Represents reflected event.
Inherited Members
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public class EventBase<THandler> : EventInfo, IEvent, IMember<EventInfo>, ICustomAttributeProvider, IEquatable<EventInfo> where THandler : MulticastDelegate
Type Parameters
| Name | Description |
|---|---|
| THandler | A delegate representing event handler. |
Properties
| Improve this Doc View SourceAddMethod
Gets event subscription method.
Declaration
public override sealed MethodInfo AddMethod { get; }
Property Value
| Type | Description |
|---|---|
| MethodInfo |
Overrides
| Improve this Doc View SourceAttributes
Gets the attributes associated with this event.
Declaration
public override sealed EventAttributes Attributes { get; }
Property Value
| Type | Description |
|---|---|
| EventAttributes |
Overrides
| Improve this Doc View SourceCustomAttributes
Gets a collection that contains this member's custom attributes.
Declaration
public override sealed IEnumerable<CustomAttributeData> CustomAttributes { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<CustomAttributeData> |
Overrides
| Improve this Doc View SourceDeclaringType
Gets the class that declares this constructor.
Declaration
public override sealed Type DeclaringType { get; }
Property Value
| Type | Description |
|---|---|
| Type |
Overrides
| Improve this Doc View SourceEventHandlerType
Gets the the underlying event-handler delegate associated with this event.
Declaration
public override sealed Type EventHandlerType { get; }
Property Value
| Type | Description |
|---|---|
| Type |
Overrides
| Improve this Doc View SourceIsMulticast
Gets a value indicating whether the event is multicast.
Declaration
public override sealed bool IsMulticast { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Overrides
| Improve this Doc View SourceMemberType
Always returns Event.
Declaration
public override sealed MemberTypes MemberType { get; }
Property Value
| Type | Description |
|---|---|
| MemberTypes |
Overrides
| Improve this Doc View SourceMetadataToken
Gets a value that identifies a metadata element.
Declaration
public override sealed int MetadataToken { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Overrides
| Improve this Doc View SourceModule
Gets the module in which the type that declares the event represented by the current instance is defined.
Declaration
public override sealed Module Module { get; }
Property Value
| Type | Description |
|---|---|
| Module |
Overrides
| Improve this Doc View SourceName
Gets name of the event.
Declaration
public override sealed string Name { get; }
Property Value
| Type | Description |
|---|---|
| String |
Overrides
| Improve this Doc View SourceRaiseMethod
Gets the method that is called when the event is raised, including non-public methods.
Declaration
public override sealed MethodInfo RaiseMethod { get; }
Property Value
| Type | Description |
|---|---|
| MethodInfo |
Overrides
| Improve this Doc View SourceReflectedType
Gets the class object that was used to obtain this instance.
Declaration
public override sealed Type ReflectedType { get; }
Property Value
| Type | Description |
|---|---|
| Type |
Overrides
| Improve this Doc View SourceRemoveMethod
Gets event unsubscription method.
Declaration
public override sealed MethodInfo RemoveMethod { get; }
Property Value
| Type | Description |
|---|---|
| MethodInfo |
Overrides
Methods
| Improve this Doc View SourceAddEventHandler(Object, THandler)
Adds an event handler to an event source.
Declaration
public virtual bool AddEventHandler(object target, THandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | target | The event source. |
| THandler | handler | Encapsulates a method or methods to be invoked when the event is raised by the target. |
Returns
| Type | Description |
|---|---|
| Boolean | true, if arguments are correct; otherwise, false. |
Equals(Object)
Determines whether this event is equal to the given event.
Declaration
public override sealed bool Equals(object other)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | other | Other event to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | true if this object reflects the same event as the specified object; otherwise, false. |
Overrides
| Improve this Doc View SourceEquals(EventInfo)
Determines whether this event is equal to the given event.
Declaration
public bool Equals(EventInfo other)
Parameters
| Type | Name | Description |
|---|---|---|
| EventInfo | other | Other event to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | true if this object reflects the same event as the specified object; otherwise, false. |
GetAddMethod(Boolean)
Gets event subscription method.
Declaration
public override sealed MethodInfo GetAddMethod(bool nonPublic)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | nonPublic | true if non-public methods can be returned; otherwise, false. |
Returns
| Type | Description |
|---|---|
| MethodInfo | Event subscription method. |
Overrides
Exceptions
| Type | Condition |
|---|---|
| MethodAccessException |
|
GetCustomAttributes(Boolean)
Returns an array of all custom attributes applied to this event.
Declaration
public override sealed object[] GetCustomAttributes(bool inherit)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. |
Returns
| Type | Description |
|---|---|
| Object[] | An array that contains all the custom attributes applied to this event. |
Overrides
| Improve this Doc View SourceGetCustomAttributes(Type, Boolean)
Returns an array of all custom attributes applied to this event.
Declaration
public override sealed object[] GetCustomAttributes(Type attributeType, bool inherit)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | attributeType | The type of attribute to search for. Only attributes that are assignable to this type are returned. |
| Boolean | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. |
Returns
| Type | Description |
|---|---|
| Object[] | An array that contains all the custom attributes applied to this event. |
Overrides
| Improve this Doc View SourceGetCustomAttributesData()
Returns a list of custom attributes that have been applied to the target event.
Declaration
public override sealed IList<CustomAttributeData> GetCustomAttributesData()
Returns
| Type | Description |
|---|---|
| IList<CustomAttributeData> | The data about the attributes that have been applied to the target event. |
Overrides
| Improve this Doc View SourceGetHashCode()
Computes hash code uniquely identifies the reflected event.
Declaration
public override sealed int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 | The hash code of the event. |
Overrides
| Improve this Doc View SourceGetOtherMethods(Boolean)
Returns the methods that have been associated with the event in metadata using the .other directive, specifying whether to include non-public methods.
Declaration
public override sealed MethodInfo[] GetOtherMethods(bool nonPublic)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | nonPublic | true if non-public methods can be returned; otherwise, false. |
Returns
| Type | Description |
|---|---|
| MethodInfo[] | An array of event methods. |
Overrides
| Improve this Doc View SourceGetRaiseMethod(Boolean)
Gets the method that is called when the event is raised.
Declaration
public override sealed MethodInfo GetRaiseMethod(bool nonPublic)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | nonPublic | true if non-public methods can be returned; otherwise, false. |
Returns
| Type | Description |
|---|---|
| MethodInfo | Raise method. |
Overrides
Exceptions
| Type | Condition |
|---|---|
| MethodAccessException |
|
GetRemoveMethod(Boolean)
Gets event unsubscription method.
Declaration
public override sealed MethodInfo GetRemoveMethod(bool nonPublic)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | nonPublic | true if non-public methods can be returned; otherwise, false. |
Returns
| Type | Description |
|---|---|
| MethodInfo | Event unsubscription method. |
Overrides
Exceptions
| Type | Condition |
|---|---|
| MethodAccessException |
|
IsDefined(Type, Boolean)
Determines whether one or more attributes of the specified type or of its derived types is applied to this event.
Declaration
public override sealed bool IsDefined(Type attributeType, bool inherit)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | attributeType | The type of custom attribute to search for. The search includes derived types. |
| Boolean | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. |
Returns
| Type | Description |
|---|---|
| Boolean | true if one or more instances of |
Overrides
| Improve this Doc View SourceRemoveEventHandler(Object, THandler)
Removes an event handler from an event source.
Declaration
public virtual bool RemoveEventHandler(object target, THandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | target | The event source. |
| THandler | handler | The delegate to be disassociated from the events raised by target. |
Returns
| Type | Description |
|---|---|
| Boolean | true, if arguments are correct; otherwise, false. |
ToString()
Returns textual representation of this event.
Declaration
public override sealed string ToString()
Returns
| Type | Description |
|---|---|
| String | The textual representation of this event. |
Overrides
Explicit Interface Implementations
| Improve this Doc View SourceIMember<EventInfo>.RuntimeMember
Declaration
EventInfo IMember<EventInfo>.RuntimeMember { get; }
Returns
| Type | Description |
|---|---|
| EventInfo |