Class Result
- Namespace
- ZeroC.Slice
- Assembly
- ZeroC.Slice.Codec.dll
Provides factory methods that create the cases of Result<TSuccess, TFailure>.
public static class Result
- Inheritance
-
Result
- Inherited Members
Remarks
These methods are useful when the compiler infers the type argument from the value, as in
Result.FromSuccess("hello"). Otherwise, construct the case directly, as in
new Failure<MyError>(new MyError.NotFound()).
Methods
FromFailure<T>(T)
Creates a failure case.
public static Failure<T> FromFailure<T>(T value)
Parameters
valueTThe failure value.
Returns
- Failure<T>
A new Failure<T>, which converts implicitly to any Result<TSuccess, TFailure> whose failure type is
T.
Type Parameters
TThe type of the failure value.
FromSuccess<T>(T)
Creates a success case.
public static Success<T> FromSuccess<T>(T value)
Parameters
valueTThe success value.
Returns
- Success<T>
A new Success<T>, which converts implicitly to any Result<TSuccess, TFailure> whose success type is
T.
Type Parameters
TThe type of the success value.