Class PreconditionResult
Represents a result type for command preconditions.
public class PreconditionResult : IResult
- Inheritance
-
PreconditionResult
- Implements
- Derived
- Inherited Members
Constructors
PreconditionResult(CommandError?, string)
Initializes a new PreconditionResult class with the command error
type
and reason.
protected PreconditionResult(CommandError? error, string errorReason)
Parameters
error
CommandError?The type of failure.
errorReason
stringThe reason of failure.
Properties
Error
Describes the error type that may have occurred during the operation.
public CommandError? Error { get; }
Property Value
- CommandError?
A CommandError indicating the type of error that may have occurred during the operation; null if the operation was successful.
ErrorReason
Describes the reason for the error.
public string ErrorReason { get; }
Property Value
- string
A string containing the error reason.
IsSuccess
Indicates whether the operation was successful or not.
public bool IsSuccess { get; }
Property Value
Methods
FromError(IResult)
Returns a PreconditionResult with the specified result
type.
public static PreconditionResult FromError(IResult result)
Parameters
result
IResultThe result of failure.
Returns
FromError(Exception)
public static PreconditionResult FromError(Exception ex)
Parameters
ex
Exception
Returns
FromError(string)
Returns a PreconditionResult with UnmetPrecondition and the specified reason.
public static PreconditionResult FromError(string reason)
Parameters
reason
stringThe reason of failure.
Returns
FromSuccess()
Returns a PreconditionResult with no errors.
public static PreconditionResult FromSuccess()
Returns
ToString()
Returns a string indicating whether the PreconditionResult is successful.
public override string ToString()