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 Where

Where<T>(Maybe<T>, Func<T, Boolean>)

Extension method allowing Maybe{T} instances to be used in LINQ where clauses.

Declaration
public static Maybe<T> Where<T>(this Maybe<T> maybe, Func<T, bool> predicate)
Parameters
Type Name Description
Maybe<T> maybe

A Maybe{T} instance to operate on.

Func<T, System.Boolean> predicate

The predicate to apply to the Maybe{T} instance.

Returns
Type Description
Maybe<T>

Either maybe if it is empty or predicate returns true, otherwise Nothing.

Type Parameters
Name Description
T

The type of value contained by the maybe.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if predicate is null.

Back to top Copyright (c) 2017 Troy Willmot