ResThrowIfErr Method

Returns the result back when IsOk; throws NullReferenceException when IsErr.
C#
static Res MakeApiCall() {
    // method that makes an api call.
    // might fail; hence, returns a Res rather than void.
}
var result = MakeApiCall().ThrowIfErr();
// result will be:
// - Ok() if MakeApiCall succeeds and returns Ok;
// - the application will throw a NullReferenceException otherwise.

Definition

Namespace: Orx.Fun.Result
Assembly: Orx.Fun.Result (in Orx.Fun.Result.dll) Version: 1.3.0+344c8bdd6f720ccfb2d8db7c61b76cf02be18f5f
C#
public Res ThrowIfErr()

Return Value

Res

See Also