Interface IResult
- Namespace
- Trellis
- Assembly
- Trellis.Core.dll
Non-generic base interface for result types, exposing success/failure state and error information.
public interface IResult
- Extension Methods
Remarks
This interface allows polymorphic handling of results without knowing the success value type. Use IResult<TValue> for typed access to the success value.
Properties
Error
Gets the error when this result is a failure, or null when it is a success.
Error? Error { get; }
Property Value
Remarks
Reading this property never throws. Pattern-match on the value to handle individual error cases. Use TryGetError(out Error?) for bool-gated imperative branches.
IsFailure
Gets a value indicating whether this result represents a failure.
[MemberNotNullWhen(true, "Error")]
bool IsFailure { get; }
Property Value
- bool
trueif the result is a failure; otherwise,false.
IsSuccess
Gets a value indicating whether this result represents a successful outcome.
[MemberNotNullWhen(false, "Error")]
bool IsSuccess { get; }
Property Value
- bool
trueif the result is successful; otherwise,false.
Methods
TryGetError(out Error?)
Attempts to get the error without throwing. Companion to Error for callers
that prefer TryParse-style imperative usage.
bool TryGetError(out Error? error)