public static T AssertOk<T, TError>(this Result<T, TError> result, string? because = null)
Asserts that the result is in the Ok state and returns the contained value.
Type Parameters
T- The success value type.
TError- The error value type.
Parameters
result- The result to inspect.
because- Optional explanation included in the failure message.
Returns: The contained Ok value.
public static TError AssertErr<T, TError>(this Result<T, TError> result, string? because = null)
Asserts that the result is in the Err state and returns the contained error.
Type Parameters
T- The success value type.
TError- The error value type.
Parameters
result- The result to inspect.
because- Optional explanation included in the failure message.
Returns: The contained Err value.
public static T AssertSome<T>(this Option<T> option, string? because = null)
Asserts that the option is in the Some state and returns the contained value.
Type Parameters
T- The contained value type.
Parameters
option- The option to inspect.
because- Optional explanation included in the failure message.
Returns: The contained Some value.