Table of Contents

Method Select

Namespace
SodaFlow.Functional
Assembly
SodaFlow.Functional.dll

Select<T, TResult>(Maybe<T>, Func<T, TResult>)

Implements the LINQ select operation for the Maybe<T> monad.

public static Maybe<TResult> Select<T, TResult>(this Maybe<T> value, Func<T, TResult> transformation)

Parameters

value Maybe<T>

The Maybe<T> value to transform.

transformation Func<T, TResult>

The transformation function, which takes a value of type T contained in the monad and transforms it into a value of type TResult.

Returns

Maybe<TResult>

The Maybe<T> which results from transforming value using transformation.

Type Parameters

T

The type of the value contained in the monad to transform.

TResult

The type of the value contained in the resulting monad.

Remarks

The same operation as Map<TResult>(Func<T, TResult>), with the name the compiler looks for. It is what lets a Maybe<T> be the source of a query expression, so that from x in m select f(x) compiles.