Method SomeNotNull
- Namespace
- SodaFlow.Functional
- Assembly
- SodaFlow.Functional.dll
SomeNotNull<T>(T?)
[Pure]
public static Maybe<T> SomeNotNull<T>(T? value) where T : class
Parameters
valueTThe reference to contain if it is not null.
Returns
Type Parameters
TThe type of the value, inferred from
value.
Remarks
This is the bridge from the older convention, where a null reference stands for the absence of a value. It is deliberately not what Some<T>(T) does. That one holds null as it holds each other value. Thus, a Maybe<T> of a nullable type can tell no value at all from a value that is null.
SomeNotNull<T>(T?)
Creates a Maybe<T> containing the value of the given Nullable<T>, if it has one.
[Pure]
public static Maybe<T> SomeNotNull<T>(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.