Class EventHandlerMarshaller<TEventHandler>
Represents a base class for event handler marshallers. This type is automatically generated by code generated for event handlers decorated with the OpenMpEventHandlerAttribute.
public abstract class EventHandlerMarshaller<TEventHandler> : IEventHandlerMarshaller<TEventHandler> where TEventHandler : class
Type Parameters
TEventHandlerThe type of the event handler.
- Inheritance
-
EventHandlerMarshaller<TEventHandler>
- Implements
-
IEventHandlerMarshaller<TEventHandler>
- Derived
- Inherited Members
Constructors
EventHandlerMarshaller()
protected EventHandlerMarshaller()
Methods
Create(TEventHandler)
Creates the unmanaged counterpart of the specified event handler.
protected abstract (nint, object) Create(TEventHandler handler)
Parameters
handlerTEventHandlerThe event handler for which to create the unmanaged counterpart.
Returns
- (nint, object)
An unmanaged handle and an object of luggage which will be kept so GC won't clean it up.
Free(nint)
Frees the resources associated with the specified unmanaged handle.
protected abstract void Free(nint handle)
Parameters
handlenintThe unmanaged handle to free.
Marshal(TEventHandler)
Marshals the specified managed event handler to a EventHandlerReference<TEventHandler>.
public EventHandlerReference<TEventHandler> Marshal(TEventHandler handler)
Parameters
handlerTEventHandlerThe managed event handler to marshal.
Returns
- EventHandlerReference<TEventHandler>
The unmanaged event handler.