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 ToMaybe

ToMaybe<T>(Nullable<T>)

Converts a to a Maybe<T> value.

Declaration
public static Maybe<T> ToMaybe<T>(this T? source)where T : struct
Parameters
Type Name Description
System.Nullable<T> source

A to be turned into a Maybe<T> instance.

Returns
Type Description
Maybe<T>

A Maybe<T> instance, either an empty instance if source is null, otherwise a non-empty instance containing the value from source.

Type Parameters
Name Description
T

The type of value used in both the nullable and maybe instances.

Back to top Copyright (c) 2017 Troy Willmot