Struct representing an optional value of type T. An option that contains the value t is called a "Some" or "Some(t)". An empty option is called a "None". Option<T> can be thought of as a far more robust version of Nullable<T> or as an IEnumerable<T> that may contain exactly 0 or 1 element(s).
More...
|
U | Cata< U > (DelegateFunc< T, U > someFunc, U noneValue) |
| If the option isSome, returns the result of someFunc applied to the option's value; otherwise, returns noneValue. More...
|
|
U | Cata< U > (DelegateFunc< T, U > someFunc, DelegateFunc< U > noneFunc) |
| If the option isSome, returns the result of someFunc applied to the option's value; otherwise, returns the result of noneFunc. More...
|
|
U | Cata< U, P > (DelegateFunc< T, P, U > someFunc, P p, U noneValue) |
| If the option isSome, returns the result of someFunc applied to the option's value and p; otherwise, returns noneValue. More...
|
|
U | Cata< U, P > (DelegateFunc< T, P, U > someFunc, P p, DelegateFunc< U > noneFunc) |
| If the option isSome, returns the result of someFunc applied to the option's value and p; otherwise, returns the result of noneFunc. More...
|
|
U | Cata< U, P, P2 > (DelegateFunc< T, P, U > someFunc, P p, DelegateFunc< P2, U > noneFunc, P2 p2) |
| If the option isSome, returns the result of someFunc applied to the option's value and p; otherwise, returns the result of noneFunc applied to p2. More...
|
|
int | CompareTo (Option< T > other) |
|
bool | Contains (T t) |
| Returns true if the option contains the specified value according to the default equality comparer; otherwise, false. More...
|
|
bool | Contains (T t, IEqualityComparer< T > comparer) |
| Returns true if the option contains the specified value according to the specified equality comparer; otherwise, false. More...
|
|
override bool | Equals (object o) |
|
bool | Equals (Option< T > other) |
|
void | ForEach (DelegateAction< T > action) |
| If the option isSome, invokes the specified delegate with the option's value; otherwise, does nothing. More...
|
|
void | ForEach< P > (DelegateAction< T, P > action, P p) |
| If the option isSome, invokes the specified delegate with the option's value and p; otherwise, does nothing. More...
|
|
void | ForEachOr (DelegateAction< T > someAction, DelegateAction noneAction) |
| If the option isSome, invokes the someAction with the option's value; otherwise, invokes noneAction. More...
|
|
void | ForEachOr< P > (DelegateAction< T, P > someAction, P p, DelegateAction noneAction) |
| If the option isSome, invokes the someAction with the option's value and p; otherwise, invokes noneAction. More...
|
|
void | ForEachOr< P, P2 > (DelegateAction< T, P > someAction, P p, DelegateAction< P2 > noneAction, P2 p2) |
| If the option isSome, invokes the someAction with the option's value and p; otherwise, invokes noneAction with p2. More...
|
|
void | ForEachOr< P2 > (DelegateAction< T > someAction, DelegateAction< P2 > noneAction, P2 p2) |
| If the option isSome, invokes the someAction with the option's value; otherwise, invokes noneAction with p2. More...
|
|
override int | GetHashCode () |
|
void | IfEmpty (DelegateAction action) |
| If the option isNone, invokes the specified delegate; otherwise, does nothing. More...
|
|
void | IfEmpty< P > (DelegateAction< P > action, P p) |
| If the option isNone, invokes the specified delegate with p; otherwise, does nothing. More...
|
|
| Option (T value) |
| Creates a Some option that contains the specified value. More...
|
|
Option< T > | Or (Option< T > noneOption) |
| If the option isSome, returns the option; otherwise, returns noneOption. More...
|
|
Option< T > | Or (DelegateFunc< Option< T >> noneFunc) |
| If the option isSome, returns the option; otherwise, returns the result of noneFunc. More...
|
|
Option< T > | Or< P > (DelegateFunc< P, Option< T >> noneFunc, P p) |
| If the option isSome, returns the option; otherwise, returns the result of noneFunc applied to p. More...
|
|
Option< U > | Select< U > (DelegateFunc< T, U > selector) |
| If the option isSome, returns an option containing the specified selector applied to the option's value; otherwise, returns an empty option. More...
|
|
Option< U > | Select< U, P > (DelegateFunc< T, P, U > selector, P p) |
| If the option isSome, returns an option containing the specified selector applied to the option's value and p; otherwise, returns an empty option. More...
|
|
Option< U > | SelectMany< U > (DelegateFunc< T, Option< U >> selector) |
| If the option isSome, returns the specified selector applied to the option's value; otherwise, returns an empty option. More...
|
|
Option< U > | SelectMany< U, P > (DelegateFunc< T, P, Option< U >> selector, P p) |
| If the option isSome, returns the specified selector applied to the option's value and p; otherwise, returns an empty option. More...
|
|
override string | ToString () |
|
T | ValueOr (T noneValue) |
| If the option isSome, returns the option's value; otherwise, returns noneValue. More...
|
|
T | ValueOr (DelegateFunc< T > noneFunc) |
| If the option isSome, returns the option's value; otherwise, returns the result of noneFunc. More...
|
|
T | ValueOr< P > (DelegateFunc< P, T > noneFunc, P p) |
| If the option isSome, returns the option's value; otherwise, returns the result of noneFunc applied to p. More...
|
|
Option< T > | Where (DelegateFunc< T, bool > predicate) |
| If the option isSome and the specified predicate applied to the option's value is true, returns the option; otherwise, returns an empty option. More...
|
|
Option< T > | Where< P > (DelegateFunc< T, P, bool > predicate, P p) |
| If the option isSome and the specified predicate applied to the option's value and p is true, returns the option; otherwise, returns an empty option. More...
|
|
Option< T > | WhereNot (DelegateFunc< T, bool > predicate) |
| If the option isSome and the specified predicate applied to the option's value is false, returns the option; otherwise, returns an empty option. More...
|
|
Option< T > | WhereNot< P > (DelegateFunc< T, P, bool > predicate, P p) |
| If the option isSome and the specified predicate applied to the option's value and p is false, returns the option; otherwise, returns an empty option. More...
|
|
Struct representing an optional value of type T. An option that contains the value t is called a "Some" or "Some(t)". An empty option is called a "None". Option<T> can be thought of as a far more robust version of Nullable<T> or as an IEnumerable<T> that may contain exactly 0 or 1 element(s).
An Option<T> has two fields:
public readonly bool isSome;
public readonly T value;
Use the isSome field to determine if the option contains a value, and the value field to read the value. Nothing prevents access to the value field of an empty option, it is up to the user to adherere to the Some / None semantics.