OperationResult<TResult>
Namespace: SnowBank.Threading.Operations · struct
Represents the result of the execution of an operation
Constructors
OperationResult<TResult>
OperationResult<TResult>(IOperationContext context)
Properties
HasFailed
bool HasFailed { get; }
Tests if the result represents a failure condition
Methods
Check
bool Check(out TResult result, out OperationError error)
Checks whether the operation was a success or a failure, and return either the result or the error
result— If the operation succeeded, receives the result; otherwise,nullerror— If the operation failed, receives the error; otherwise,null
Returns: true if the operation completed successfully; otherwise, false.
EnsureSuccess
TResult EnsureSuccess()
Returns the result of the operation, or throws if the operation failed
Returns: Result of the operation (if it was successful)
Fields
Context
readonly IOperationContext Context
Context of the operation that produced this result