Skip to content

Class ReflectionEventDescriptor<TTarget, THandler>

Definition

Namespace: StardewUI.Framework.Descriptors
Assembly: StardewUI.dll

Reflection-based implementation of an event descriptor.

public class ReflectionEventDescriptor<TTarget, THandler> : 
    StardewUI.Framework.Descriptors.IEventDescriptor, 
    StardewUI.Framework.Descriptors.IMemberDescriptor

Type Parameters

TTarget
The type that declares the event.

THandler
The event handler (delegate) type.

Inheritance
Object ⇦ ReflectionEventDescriptor<TTarget, THandler>

Implements
IEventDescriptor, IMemberDescriptor

Members

Properties

Name Description
ArgsTypeDescriptor Descriptor for the type of event object (arguments), generally a subtype of EventArgs.
DeclaringType The type on which the member is declared.
DelegateParameterCount Number of parameters that the Invoke method of the DelegateType accepts.
DelegateType The type (subtype of Delegate) that can be added/removed from the event handlers.
Name The member name.

Methods

Name Description
Add(Object, Delegate) Adds an event handler.
Equals(Object) (Overrides Object.Equals(Object))
GetHashCode() (Overrides Object.GetHashCode())
Remove(Object, Delegate) Removes an event handler.

Details

Properties

ArgsTypeDescriptor

Descriptor for the type of event object (arguments), generally a subtype of EventArgs.

public StardewUI.Framework.Descriptors.IObjectDescriptor ArgsTypeDescriptor { get; }
Property Value

IObjectDescriptor


DeclaringType

The type on which the member is declared.

public System.Type DeclaringType { get; }
Property Value

Type


DelegateParameterCount

Number of parameters that the Invoke method of the DelegateType accepts.

public int DelegateParameterCount { get; }
Property Value

Int32


DelegateType

The type (subtype of Delegate) that can be added/removed from the event handlers.

public System.Type DelegateType { get; }
Property Value

Type


Name

The member name.

public string Name { get; }
Property Value

string


Methods

Add(Object, Delegate)

Adds an event handler.

public void Add(System.Object target, System.Delegate handler);
Parameters

target   Object
The instance of the DeclaringType on which to subscribe to events.

handler   Delegate
The handler to run when the event is raised; must be assignable to the DelegateType.


Equals(Object)

public override bool Equals(System.Object obj);
Parameters

obj   Object

Returns

Boolean


GetHashCode()

public override int GetHashCode();
Returns

Int32


Remove(Object, Delegate)

Removes an event handler.

public void Remove(System.Object target, System.Delegate handler);
Parameters

target   Object
The instance of the DeclaringType on which to unsubscribe from events.

handler   Delegate
The handler that was previously registered, i.e. via Add(Object, Delegate).