Class EventBase<D>
Represents reflected event.
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public class EventBase<D> : EventInfo, IEvent, IMember<EventInfo>, ICustomAttributeProvider, IEquatable<EventInfo> where D : MulticastDelegate
Type Parameters
| Name | Description |
|---|---|
| D | 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 |
Attributes
Gets the attributes associated with this event.
Declaration
public override sealed EventAttributes Attributes { get; }
Property Value
| Type | Description |
|---|---|
| EventAttributes |
CustomAttributes
Gets a collection that contains this member's custom attributes.
Declaration
public override sealed IEnumerable<CustomAttributeData> CustomAttributes { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<CustomAttributeData> |
DeclaringType
Gets the class that declares this constructor.
Declaration
public override sealed Type DeclaringType { get; }
Property Value
| Type | Description |
|---|---|
| DotNext.Reflection.Type |
EventHandlerType
Gets the the underlying event-handler delegate associated with this event.
Declaration
public override sealed Type EventHandlerType { get; }
Property Value
| Type | Description |
|---|---|
| DotNext.Reflection.Type |
IsMulticast
Gets a value indicating whether the event is multicast.
Declaration
public override sealed bool IsMulticast { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
MemberType
Always returns
Declaration
public override sealed MemberTypes MemberType { get; }
Property Value
| Type | Description |
|---|---|
| MemberTypes |
MetadataToken
Gets a value that identifies a metadata element.
Declaration
public override sealed int MetadataToken { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Module
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 |
Name
Gets name of the event.
Declaration
public override sealed string Name { get; }
Property Value
| Type | Description |
|---|---|
| String |
RaiseMethod
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 |
ReflectedType
Gets the class object that was used to obtain this instance.
Declaration
public override sealed Type ReflectedType { get; }
Property Value
| Type | Description |
|---|---|
| DotNext.Reflection.Type |
RemoveMethod
Gets event unsubscription method.
Declaration
public override sealed MethodInfo RemoveMethod { get; }
Property Value
| Type | Description |
|---|---|
| MethodInfo |
Methods
| Improve this Doc View SourceAddEventHandler(Object, D)
Adds an event handler to an event source.
Declaration
public virtual bool AddEventHandler(object target, D handler)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | target | The event source. |
| D | 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(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. |
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. |
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. |
GetCustomAttributes(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 |
|---|---|---|
| DotNext.Reflection.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. |
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. |
GetCustomAttributesData()
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. |
GetHashCode()
Computes hash code uniquely identifies the reflected event.
Declaration
public override sealed int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 | The hash code of the event. |
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.
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. |
GetRaiseMethod(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. |
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. |
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 |
|---|---|---|
| DotNext.Reflection.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 |
RemoveEventHandler(Object, D)
Removes an event handler from an event source.
Declaration
public virtual bool RemoveEventHandler(object target, D handler)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | target | The event source. |
| D | 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. |
Explicit Interface Implementations
| Improve this Doc View SourceIMember<EventInfo>.RuntimeMember
Declaration
EventInfo IMember<EventInfo>.RuntimeMember { get; }
Returns
| Type | Description |
|---|---|
| EventInfo |