Method ToMaybe
- Namespace
- SodaFlow.Functional
- Assembly
- SodaFlow.Functional.dll
ToMaybe<T>(T?)
[Pure]
public static Maybe<T> ToMaybe<T>(this T? value) where T : class
Parameters
valueTThe reference to change.
Returns
Type Parameters
TThe type of the reference.
Remarks
The same thing as SomeNotNull<T>(T?), in the position which reads better at the end of a chain.
ToMaybe<T>(T?)
Changes a Nullable<T> into a Maybe<T>.
[Pure]
public static Maybe<T> ToMaybe<T>(this T? value) where T : struct
Parameters
valueT?The nullable value to change.
Returns
- Maybe<T>
A Maybe<T> containing the value of
valueif it has one, and one containing no value otherwise.
Type Parameters
TThe underlying type of
value.
Remarks
The same thing as SomeNotNull<T>(T?), in the position which reads better at the end of a chain. ToNullable<T>(Maybe<T>) changes back.