None<T> Class

Summary

A representation for an IOption without a value.
Namespace
FunctionalSharp.OptionTypes
Interfaces
  • IOption<T>
Base Types
  • object
graph TD Base0["object"]-->Type Interface0["IOption<T>"]-.->Type Type["None<T>"] class Type type-node

Syntax

[Serializable]
public class None<T> : IOption<T>

Attributes

Type Description
SerializableAttribute

Type Parameters

Name Description
T

Constructors

Name Summary
None() Creates a new None of T. The type T must be nullable, if not an exception will be thrown

Methods

Name Value Summary
IfNotNullDo(Action<T>) void
Does nothing since None doesnt hold a value.
Match(Action<T>, Action) void
Executes the action withoutValue.
Match<TResult>(Func<T, TResult>, Func<TResult>) TResult
returns the value generated by running withoutValue.
Match<TResult>(Func<T, TResult>, TResult) TResult
returns the value in the parameter withoutValue.
ToNullable() T
Returns null.
ToString() string
returns a string "null value for" with the name of the type.

Extension Methods

Name Value Summary
Match<None<T>>() PatternMatchSingleContext<T>
Starts a pattern match for a single value. Subsequent calls to With() need to be used to specify conditions
ToOption<None<T>>() IOption<T>
Turns the type T into an option type.