Delegate MessageHandler<TRecipient, TMessage>
- Namespace
- CommunityToolkit.Mvvm.Messaging
- Assembly
- CommunityToolkit.Mvvm.dll
A delegate used to represent actions to invoke when a message is received. The recipient is given as an input argument to allow message registrations to avoid creating closures: if an instance method on a recipient needs to be invoked it is possible to just cast the recipient to the right type and then access the local method from that instance.
public delegate void MessageHandler<in TRecipient, in TMessage>(TRecipient recipient, TMessage message) where TRecipient : class where TMessage : class
Parameters
recipient
TRecipientThe recipient that is receiving the message.
message
TMessageThe message being received.
Type Parameters
TRecipient
The type of recipient for the message.
TMessage
The type of message to receive.
Constructors
MessageHandler(object, nint)
public MessageHandler(object @object, nint method)
Parameters
Methods
BeginInvoke(TRecipient, TMessage, AsyncCallback, object)
public virtual IAsyncResult BeginInvoke(TRecipient recipient, TMessage message, AsyncCallback callback, object @object)
Parameters
recipient
TRecipientmessage
TMessagecallback
AsyncCallbackobject
object
Returns
EndInvoke(IAsyncResult)
public virtual void EndInvoke(IAsyncResult result)
Parameters
result
IAsyncResult
Invoke(TRecipient, TMessage)
public virtual void Invoke(TRecipient recipient, TMessage message)
Parameters
recipient
TRecipientmessage
TMessage