Method Select
Select<T, TResult>(Maybe<T>, Func<T, Maybe<TResult>>)
Converts a Maybe<T> to a Maybe{TResult} using the function provided.
Declaration
public static Maybe<TResult> Select<T, TResult>(this Maybe<T> maybe, Func<T, Maybe<TResult>> predicate)
Parameters
Type | Name | Description |
---|---|---|
Maybe<T> | maybe | The maybe to convert. |
Func<T, Maybe<TResult>> | predicate | A function that converts the value of |
Returns
Type | Description |
---|---|
Maybe<TResult> | A Maybe{T} instance that is either nothing, or the result of the |
Type Parameters
Name | Description |
---|---|
T | The type of value contained in the |
TResult | The type of value in the returned Maybe<T> instance. |
Remarks
If maybe
is nothing then an empty instance of Maybe{TResult} is returned, otherwise the predicate
function is used to calculate the return value.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |
Select<T, TResult>(Maybe<T>, Func<T, TResult>)
Converts a Maybe<T> to a Maybe{TResult} using the function provided.
Declaration
public static Maybe<TResult> Select<T, TResult>(this Maybe<T> maybe, Func<T, TResult> predicate)
Parameters
Type | Name | Description |
---|---|---|
Maybe<T> | maybe | The maybe to convert. |
Func<T, TResult> | predicate | A function that converts the value of |
Returns
Type | Description |
---|---|
Maybe<TResult> | A Maybe{T} instance that is either nothing, or the result of the |
Type Parameters
Name | Description |
---|---|
T | The type of value contained in the |
TResult | The type of value in the returned Maybe<T> instance. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |
Select<T, TResult>(IEnumerable<Maybe<T>>, Func<T, Maybe<TResult>>)
Converts an
Declaration
public static IEnumerable<Maybe<TResult>> Select<T, TResult>(this IEnumerable<Maybe<T>> source, Func<T, Maybe<TResult>> predicate)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Maybe<T>> | source | The |
Func<T, Maybe<TResult>> | predicate | A function that converts a {T} value to a Maybe{TResult}. |
Returns
Type | Description |
---|---|
IEnumerable<Maybe<TResult>> | A set of Maybe{TResult} values. |
Type Parameters
Name | Description |
---|---|
T | The type of value contained with the Maybe<T> instances in the |
TResult | The type of value contained in the Maybe<T> instances returned. |
Remarks
If source
is null then an empty set is returned.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |