Class CommandResult<T>
Represents the result of a command operation with a return value
public record CommandResult<T> : IEquatable<CommandResult<T>>
Type Parameters
TThe type of the return value
- Inheritance
-
CommandResult<T>
- Implements
- Inherited Members
Constructors
CommandResult(bool, T?, string?)
Represents the result of a command operation with a return value
public CommandResult(bool Success, T? Value = default, string? ErrorMessage = null)
Parameters
Properties
ErrorMessage
public string? ErrorMessage { get; init; }
Property Value
Success
public bool Success { get; init; }
Property Value
Value
public T? Value { get; init; }
Property Value
- T
Methods
Fail(string)
Creates a failed command result with an error message
public static CommandResult<T> Fail(string errorMessage)
Parameters
errorMessagestring
Returns
Ok(T)
Creates a successful command result with a value
public static CommandResult<T> Ok(T value)
Parameters
valueT