OptionExtensionsSomeT Method

Creates an option of T as Some variant with the given value. However, if the value is null, it will map into None.
C#
Opt<double> number = Some(42.5);
Assert(number.IsSome and number.Unwrap() == 42.5);

// on the other hand:
string name = null;
Opt<string> optName = Some(name);
Assert(optName.IsNone);

Definition

Namespace: Orx.Fun.Option
Assembly: Orx.Fun.Option (in Orx.Fun.Option.dll) Version: 1.2.1+ea79806fa5e0e04bfdaef2a1916930e75e2cde74
C#
public static Opt<T> Some<T>(
	T value
)

Parameters

value  T
Expectedly non-null value of T.

Type Parameters

T

[Missing <typeparam name="T"/> documentation for "M:Orx.Fun.Option.OptionExtensions.Some``1(``0)"]

Return Value

OptT

See Also