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
errorCommandError?The type of failure.
errorReasonstringThe 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
resultIResultThe result of failure.
Returns
FromError(Exception)
public static PreconditionResult FromError(Exception ex)
Parameters
exException
Returns
FromError(string)
Returns a PreconditionResult with UnmetPrecondition and the specified reason.
public static PreconditionResult FromError(string reason)
Parameters
reasonstringThe 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()