ResultExtensionsOkT(T) Method

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);

Definition

Namespace: Orx.Fun.Result
Assembly: Orx.Fun.Result (in Orx.Fun.Result.dll) Version: 1.3.0+344c8bdd6f720ccfb2d8db7c61b76cf02be18f5f
C#
public static Res<T> Ok<T>(
	T value
)

Parameters

value  T
Expectedly non-null value of T.

Type Parameters

T

[Missing <typeparam name="T"/> documentation for "M:Orx.Fun.Result.ResultExtensions.Ok``1(``0)"]

Return Value

ResT

See Also