Table of Contents

Class RequestMessage<T>

Namespace
CommunityToolkit.Mvvm.Messaging.Messages
Assembly
CommunityToolkit.Mvvm.dll

A class for request messages, which can either be used directly or through derived classes.

public class RequestMessage<T>

Type Parameters

T

The type of request to make.

Inheritance
RequestMessage<T>
Inherited Members

Constructors

RequestMessage()

public RequestMessage()

Properties

HasReceivedResponse

Gets a value indicating whether a response has already been assigned to this instance.

public bool HasReceivedResponse { get; }

Property Value

bool

Response

Gets the message response.

public T Response { get; }

Property Value

T

Exceptions

InvalidOperationException

Thrown when HasReceivedResponse is false.

Methods

Reply(T)

Replies to the current request message.

public void Reply(T response)

Parameters

response T

The response to use to reply to the request message.

Exceptions

InvalidOperationException

Thrown if Response has already been set.

Operators

implicit operator T(RequestMessage<T>)

Implicitly gets the response from a given RequestMessage<T> instance.

public static implicit operator T(RequestMessage<T> message)

Parameters

message RequestMessage<T>

The input RequestMessage<T> instance.

Returns

T

Exceptions

ArgumentNullException

Thrown if message is null.

InvalidOperationException

Thrown when HasReceivedResponse is false.