1
0
mirror of https://github.com/chylex/.NET-Community-Toolkit.git synced 2025-04-10 11:15:45 +02:00

Minor code refactoring

This commit is contained in:
Sergio Pedri 2020-04-15 14:24:44 +02:00
parent 82c927e9fd
commit 90040fc0de
2 changed files with 6 additions and 6 deletions
Microsoft.Toolkit.Mvvm/Messaging

View File

@ -6,10 +6,10 @@
namespace Microsoft.Toolkit.Mvvm.Messaging.Messages
{
/// <summary>
/// A base <see langword="class"/> for request messages.
/// A <see langword="class"/> for request messages, which can either be used directly or through derived classes.
/// </summary>
/// <typeparam name="T">The type of request to make.</typeparam>
public abstract class RequestMessageBase<T>
public class RequestMessage<T>
{
/// <summary>
/// An <see cref="object"/> used to synchronize access to <see cref="Result"/> and <see cref="ReportResult"/>.

View File

@ -445,7 +445,7 @@ public static void Send<TMessage, TToken>(TMessage message, TToken token)
/// a new <typeparamref name="TMessage"/> instance and send that to its recipients.
/// </remarks>
public static TResult Request<TMessage, TResult>()
where TMessage : RequestMessageBase<TResult>, new()
where TMessage : RequestMessage<TResult>, new()
{
return Request<TMessage, TResult, Unit>(new TMessage(), default);
}
@ -459,7 +459,7 @@ public static TResult Request<TMessage, TResult>()
/// <returns>The <typeparamref name="TResult"/> response value for the given message.</returns>
/// <exception cref="InvalidOperationException">Thrown if no response is received for the message.</exception>
public static TResult Request<TMessage, TResult>(TMessage message)
where TMessage : RequestMessageBase<TResult>
where TMessage : RequestMessage<TResult>
{
return Request<TMessage, TResult, Unit>(message, default);
}
@ -478,7 +478,7 @@ public static TResult Request<TMessage, TResult>(TMessage message)
/// just like <see cref="Send{TMessage}()"/>, and then send it to the right recipients.
/// </remarks>
public static TResult Request<TMessage, TResult, TToken>(TToken token)
where TMessage : RequestMessageBase<TResult>, new()
where TMessage : RequestMessage<TResult>, new()
where TToken : notnull, IEquatable<TToken>
{
return Request<TMessage, TResult, TToken>(new TMessage(), token);
@ -495,7 +495,7 @@ public static TResult Request<TMessage, TResult, TToken>(TToken token)
/// <returns>The <typeparamref name="TResult"/> response value for the given message.</returns>
/// <exception cref="InvalidOperationException">Thrown if no response is received for the message.</exception>
public static TResult Request<TMessage, TResult, TToken>(TMessage message, TToken token)
where TMessage : RequestMessageBase<TResult>
where TMessage : RequestMessage<TResult>
where TToken : notnull, IEquatable<TToken>
{
Send(message, token);