ResultExtensionsOk Method

Overload List

Ok Creates a result as the Ok variant.
C#
Res result = Ok();
Assert(result.IsOk);
OkT(T) Creates a result of T as Ok variant with value value. However, if the value is null, it will map into Err.
C#
Res<double> number = Ok(42.5);
Assert(number.IsOk and number.Unwrap() == 42.5);

// on the other hand:
string name = null;
Res<string> optName = Ok(name);
Assert(optName.IsErr);

See Also