Show / Hide Table of Contents

Class EventMemberDescriptor

Class providing easier marshalling of CLR events. Handling is limited to a narrow range of handler signatures, which, however, covers in practice most of all available events.

Inheritance
System.Object
EventMemberDescriptor
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public class EventMemberDescriptor : IMemberDescriptor

Constructors

EventMemberDescriptor(EventInfo, InteropAccessMode)

Initializes a new instance of the EventMemberDescriptor class.

Declaration
public EventMemberDescriptor(EventInfo ei, InteropAccessMode accessMode = InteropAccessMode.Default)
Parameters
EventInfo ei

The ei.

InteropAccessMode accessMode

The access mode.

Fields

MAX_ARGS_IN_DELEGATE

The maximum number of arguments supported in an event handler delegate

Declaration
public const int MAX_ARGS_IN_DELEGATE = 16
Field Value
System.Int32

Properties

EventInfo

Gets the EventInfo object of the event described by this descriptor

Declaration
public EventInfo EventInfo { get; }
Property Value
EventInfo

IsStatic

Gets a value indicating whether the event described by this descriptor is static.

Declaration
public bool IsStatic { get; }
Property Value
System.Boolean

MemberAccess

Gets the types of access supported by this member

Declaration
public MemberDescriptorAccess MemberAccess { get; }
Property Value
MemberDescriptorAccess

Name

Gets the name of the member

Declaration
public string Name { get; }
Property Value
System.String

Methods

CheckEventIsCompatible(EventInfo, Boolean)

Checks if the event is compatible with a standard descriptor

Declaration
public static bool CheckEventIsCompatible(EventInfo ei, bool throwException)
Parameters
EventInfo ei

The EventInfo.

System.Boolean throwException

if set to true an exception with the proper error message is thrown if not compatible.

Returns
System.Boolean

Exceptions
System.ArgumentException

Thrown if throwException is true and one of this applies: The event is declared in a value type or The event does not have both add and remove methods or The event handler type doesn't implement a public Invoke method or The event handler has a return type which is not System.Void or The event handler has more than MAX_ARGS_IN_DELEGATE parameters or The event handler has a value type parameter or a by ref parameter or The event handler signature is not a valid method according to CheckMethodIsCompatible(MethodBase, Boolean)

GetValue(Script, Object)

Gets a dynvalue which is a facade supporting add/remove methods which is callable from scripts

Declaration
public DynValue GetValue(Script script, object obj)
Parameters
Script script

The script.

System.Object obj

The object for which the facade should be written.

Returns
DynValue

SetValue(Script, Object, DynValue)

Sets the value.

Declaration
public void SetValue(Script script, object obj, DynValue v)
Parameters
Script script

The script.

System.Object obj

The object.

DynValue v

The v.

TryCreateIfVisible(EventInfo, InteropAccessMode)

Tries to create a new StandardUserDataEventDescriptor, returning null in case the method is not visible to script code.

Declaration
public static EventMemberDescriptor TryCreateIfVisible(EventInfo ei, InteropAccessMode accessMode)
Parameters
EventInfo ei

The EventInfo.

InteropAccessMode accessMode

The InteropAccessMode

Returns
EventMemberDescriptor

A new StandardUserDataEventDescriptor or null.

Back to top Built by Itinero, MIT licensed.