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
recipientTRecipientThe recipient that is receiving the message.
messageTMessageThe message being received.
Type Parameters
TRecipientThe type of recipient for the message.
TMessageThe 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
recipientTRecipientmessageTMessagecallbackAsyncCallbackobjectobject
Returns
EndInvoke(IAsyncResult)
public virtual void EndInvoke(IAsyncResult result)
Parameters
resultIAsyncResult
Invoke(TRecipient, TMessage)
public virtual void Invoke(TRecipient recipient, TMessage message)
Parameters
recipientTRecipientmessageTMessage