編輯

共用方式為


IMessengerExtensions.Send Method

Definition

Overloads

Send<TMessage,TToken>(IMessenger, TToken)

Sends a message of the specified type to all registered recipients.

Send<TMessage>(IMessenger)

Sends a message of the specified type to all registered recipients.

Send<TMessage>(IMessenger, TMessage)

Sends a message of the specified type to all registered recipients.

Send<TMessage,TToken>(IMessenger, TToken)

Sends a message of the specified type to all registered recipients.

public static TMessage Send<TMessage,TToken> (this Microsoft.Toolkit.Mvvm.Messaging.IMessenger messenger, TToken token) where TMessage : class, new() where TToken : IEquatable<TToken>;
static member Send : Microsoft.Toolkit.Mvvm.Messaging.IMessenger * 'oken -> 'Message (requires 'Message : null and 'Message : (new : unit -> 'Message) and 'oken :> IEquatable<'oken>)
<Extension()>
Public Function Send(Of TMessage As {Class, New}, TToken As {Class, New}) (messenger As IMessenger, token As TToken) As TMessage

Type Parameters

TMessage

The type of message to send.

TToken

The type of token to identify what channel to use to send the message.

Parameters

messenger
IMessenger

The IMessenger instance to use to send the message.

token
TToken

The token indicating what channel to use.

Returns

TMessage

The message that has been sen.

Remarks

This method will automatically create a new TMessage instance just like Send<TMessage>(IMessenger), and then send it to the right recipients.

Applies to

Send<TMessage>(IMessenger)

Sends a message of the specified type to all registered recipients.

public static TMessage Send<TMessage> (this Microsoft.Toolkit.Mvvm.Messaging.IMessenger messenger) where TMessage : class, new();
static member Send : Microsoft.Toolkit.Mvvm.Messaging.IMessenger -> 'Message (requires 'Message : null and 'Message : (new : unit -> 'Message))
<Extension()>
Public Function Send(Of TMessage As {Class, New}) (messenger As IMessenger) As TMessage

Type Parameters

TMessage

The type of message to send.

Parameters

messenger
IMessenger

The IMessenger instance to use to send the message.

Returns

TMessage

The message that has been sent.

Remarks

This method is a shorthand for Send<TMessage>(IMessenger, TMessage) when the message type exposes a parameterless constructor: it will automatically create a new TMessage instance and send that to its recipients.

Applies to

Send<TMessage>(IMessenger, TMessage)

Sends a message of the specified type to all registered recipients.

public static TMessage Send<TMessage> (this Microsoft.Toolkit.Mvvm.Messaging.IMessenger messenger, TMessage message) where TMessage : class;
static member Send : Microsoft.Toolkit.Mvvm.Messaging.IMessenger * 'Message -> 'Message (requires 'Message : null)
<Extension()>
Public Function Send(Of TMessage As Class) (messenger As IMessenger, message As TMessage) As TMessage

Type Parameters

TMessage

The type of message to send.

Parameters

messenger
IMessenger

The IMessenger instance to use to send the message.

message
TMessage

The message to send.

Returns

TMessage

The message that was sent (ie. message).

Applies to