Cadenza : Cadenza Namespace

NullableCoda Class

Extension and utility methods for Nullable<T>.

public static class NullableCoda

Remarks

Requirements

Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0

Members

See Also: Inherited members from object.

Public Methods

static
Just<T> (this Nullable<T>) : Maybe<T>
Create a new Cadenza.Maybe<T> instance initialized to a specified value. The returned value will not be Maybe<T>.Nothing.
static
ToMaybe<T> (this Nullable<T>) : Maybe<T>
Create a new Cadenza.Maybe<T> instance initialized to a specified value. The returned value may be Maybe<T>.Nothing.

Member Details

Just<T> Generic Method

Create a new Cadenza.Maybe<T> instance initialized to a specified value. The returned value will not be Maybe<T>.Nothing.

public static Maybe<T> Just<T> (this Nullable<T> self)
where T : struct

See Also

ObjectCoda.ToMaybe``1(``0)

Type Parameters

T
The type to convert into a Cadenza.Maybe<T>.

Parameters

self
A value of type Nullable<T> to convert into a Cadenza.Maybe<T>.

Returns

A new Cadenza.Maybe<T> instance initialized to a specified value.

The returned value will not be Maybe<T>.Nothing.

Exceptions

Type Reason
ArgumentNullException selfs Nullable<T>.HasValue property is false.

Remarks

Use this method when you want to ensure that Cadenza.Maybe<T> instance is created in which Maybe<T>.Value will not throw.

Requirements

Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0

ToMaybe<T> Generic Method

Create a new Cadenza.Maybe<T> instance initialized to a specified value. The returned value may be Maybe<T>.Nothing.

public static Maybe<T> ToMaybe<T> (this Nullable<T> self)
where T : struct

See Also

NullableCoda.Just``1(``0)

Type Parameters

T
The type to convert into a Cadenza.Maybe<T>.

Parameters

self
A value of type Nullable<T> to convert into a Cadenza.Maybe<T>.

Returns

A new Cadenza.Maybe<T> instance initialized to a specified value.

Note: The value returned may be Maybe<T>.Nothing.

Remarks

Use this method when you want to ensure that a possibly invalid Cadenza.Maybe<T> instance is created. if Nullable<T>.HasValue is false, then Maybe<T>.Nothing will be returned; otherwise, a new Cadenza.Maybe<T> will be created containing the value within self.

Requirements

Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0