Show / Hide Table of Contents
  • MaybeSharp
    • Maybe<T>
      • As
      • Bind
      • Cast
      • CompareTo
      • Equality
      • Equals
      • Explicit
      • GetHashCode
      • GreaterThan
      • GreaterThanOrEqual
      • HasValue
      • Implicit
      • Inequality
      • IsEmpty
      • LessThan
      • LessThanOrEqual
      • Maybe
      • Nothing
      • ToString
      • Value
  • MaybeSharp.Extensions
    • MaybeDictionaryExtensions
      • TryGetValue
    • MaybeExtensions
      • Coalesce
      • Or
      • Select
      • SelectMany
      • SelectNonempty
      • ToNullable
      • ValueOr
      • ValueOrException
      • WhenNothing
      • WhenSomething
      • Where
    • MaybeStringExtensions
      • TryParseBoolean
      • TryParseByte
      • TryParseChar
      • TryParseDateTime
      • TryParseDateTimeOffset
      • TryParseDecimal
      • TryParseDouble
      • TryParseInt
      • TryParseInt16
      • TryParseInt64
      • TryParseSingle
    • NullableExtensions
      • ToMaybe

Method SelectMany

SelectMany<T, TOther, TResult>(Maybe<T>, Func<T, Maybe<TOther>>, Func<T, TOther, TResult>)

Allows values from multiple maybe instances to be combined in the select portion of a LINQ query.

Declaration
public static Maybe<TResult> SelectMany<T, TOther, TResult>(this Maybe<T> maybe, Func<T, Maybe<TOther>> converter, Func<T, TOther, TResult> combiner)
Parameters
Type Name Description
Maybe<T> maybe

A maybe instance to combine.

Func<T, Maybe<TOther>> converter

A function that takes the value of maybe (when non-empty) and returns a Maybe{TOther} result.

Func<T, TOther, TResult> combiner

Function that combines values of T and TOther to return a TResult.

Returns
Type Description
Maybe<TResult>

A Maybe{TResult} containing the result of the combiner function. Will be Mabye{T}.Not

Type Parameters
Name Description
T

The type of the first maybe instance.

TOther

The type of the second maybe instance.

TResult

The type of the result of combining the two types.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if converter or combiner is null.

Back to top Copyright (c) 2017 Troy Willmot