Table of Contents

Method ToMaybe

Namespace
SodaFlow.Functional
Assembly
SodaFlow.Functional.dll

ToMaybe<T>(T?)

Changes a reference which can be null into a Maybe<T>.

[Pure]
public static Maybe<T> ToMaybe<T>(this T? value) where T : class

Parameters

value T

The reference to change.

Returns

Maybe<T>

A Maybe<T> containing value if it is not null, and one containing no value otherwise.

Type Parameters

T

The 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

value T?

The nullable value to change.

Returns

Maybe<T>

A Maybe<T> containing the value of value if it has one, and one containing no value otherwise.

Type Parameters

T

The 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.