Table of Contents

Class MaybeReferenceTypeExtensions

Namespace
Existential
Assembly
Existential.Net.dll

Provides extension methods for converting Maybe<T>, to a nullable reference type (T?) in a nullable context. When used outside a nullable context, the value will be returned as a reference type (T), which may be null. Static null checking is better in a nullable context.

public static class MaybeReferenceTypeExtensions
Inheritance
System.Object
MaybeReferenceTypeExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

Methods

ToCollectionOfNullable<T>(IEnumerable<Maybe<T>>)

In a nullable context, converts a collection of Maybe<T> to a collection of nullable reference types (T?) of the same values. When used outside a nullable context, the value will be returned as a reference type (T) - which may be null. Static null checking is better in a nullable context.

public static IEnumerable<T> ToCollectionOfNullable<T>(this IEnumerable<Maybe<T>> inCollection)

    where T : class

Parameters

inCollection System.Collections.Generic.IEnumerable<Maybe<T>>

The collection containing the values to be converted from Maybe<T> to nullable reference types.

Returns

System.Collections.Generic.IEnumerable<T>

A collection of nullable reference types (T?) with the values of the Maybe<T>s in the original collection inCollection. When used outside a nullable context, the vale will be returned as a reference type (T) - which may be null.

Type Parameters

T

The type of the value encapsulated in any Maybe<T>s in the collection.

ToNullable<T>(Maybe<T>)

In a nullable context, returns the value of a Maybe<T> as a nullable reference type (T?). When used outside a nullable context, the value will be returned as a reference type (T), which may be null. Static null checking is better in a nullable context.

public static T ToNullable<T>(this Maybe<T> inMaybe)

    where T : class

Parameters

inMaybe Maybe<T>

The Maybe<T> to get a value from.

Returns

T

In a nullable context, returns a nullable reference type (T?) containing the value of the Maybe<T> inMaybe. When used outside a nullable context, the value will be returned as a reference type (T) - which may be null.

Type Parameters

T

The type of the value encapsulated in the Maybe<T>.

See Also