Table of Contents

Class Maybe

Namespace
LfrlAnvil.Functional
Assembly
LfrlAnvil.Functional.dll

Creates instances of Maybe<T> type.

public static class Maybe
Inheritance
Maybe
Inherited Members

Fields

None

Represents a lack of value.

public static readonly Nil None

Field Value

Nil

Methods

GetUnderlyingType(Type?)

Attempts to extract the underlying type from the provided Maybe<T>type.

[Pure]
public static Type? GetUnderlyingType(Type? type)

Parameters

type Type

Type to extract the underlying type from.

Returns

Type

Underlying Maybe<T> type or null when the provided type is not related to the Maybe<T> type.

Some<T>(T?)

Creates a new Maybe<T> instance with a value.

[Pure]
public static Maybe<T> Some<T>(T? value) where T : notnull

Parameters

value T

Underlying value.

Returns

Maybe<T>

New Maybe<T> instance.

Type Parameters

T

Value type.

Exceptions

ArgumentNullException

When value is null.