A struct that represents a value that could or could not exist. Unlike the built-int nullable types, you are unable to access the value unless it does exist, and will never recieve a null value.
More...
|
| Maybe (T t) |
| Constructs a Maybe given a value. If the value is not null, this maybe will have a value. If the value is null, this maybe will have no value. For value types, the Maybe struct will always have a value. (Use Maybe.None to refer to "no value.") More...
|
|
bool | TryGetValue (out T t) |
| If this Maybe has a value, the out argument is filled with that value and this method returns true, else it returns false. More...
|
|
void | Match (Action< T > ifValue) |
| If this Maybe has a value, the delegate is called with that value. More...
|
|
void | Match (Action< T > ifValue, Action ifNot) |
| If this Maybe has a value, the first delegate is called with that value, else the second delegate is called. More...
|
|
K | Match< K > (Func< T, K > ifValue, Func< K > ifNot) |
| If this Maybe has a value, the first delegate is called with that value, else the second delegate is called. More...
|
|
T | ValueOr (T customDefault) |
| If this Maybe has a value, returns the value, otherwise returns the argument custom default value. More...
|
|
Maybe< T > | ValueOr (Maybe< T > maybeCustomDefault) |
| Returns this Maybe if it has a value, otherwise returns the argument Maybe value. Useful for overlaying multiple Maybe values. For example, if I want to overlay a "maybe override font" variable with another "maybe override font" variable, I can call: this.font = other.font.ValueOr(this.font); More...
|
|
Query< T > | Query () |
|
override int | GetHashCode () |
|
override bool | Equals (object obj) |
|
bool | Equals (Maybe< T > other) |
|
int | CompareTo (object obj) |
|
int | CompareTo (Maybe< T > other) |
|
|
static Maybe< T > | Some< T > (T value) |
|
static void | MatchAll< A, B > (Maybe< A > maybeA, Maybe< B > maybeB, Action< A, B > action) |
|
static void | MatchAll< A, B, C > (Maybe< A > maybeA, Maybe< B > maybeB, Maybe< C > maybeC, Action< A, B, C > action) |
|
static void | MatchAll< A, B, C, D > (Maybe< A > maybeA, Maybe< B > maybeB, Maybe< C > maybeC, Maybe< D > maybeD, Action< A, B, C, D > action) |
|
static Maybe< T > | Some (T t) |
| Constructs a Maybe given a specific value. This value needs to always be non-null if the type is a reference type. More...
|
|
static bool | operator== (Maybe< T > maybe0, Maybe< T > maybe1) |
|
static bool | operator!= (Maybe< T > maybe0, Maybe< T > maybe1) |
|
static bool | operator> (Maybe< T > maybe0, Maybe< T > maybe1) |
|
static bool | operator>= (Maybe< T > maybe0, Maybe< T > maybe1) |
|
static bool | operator< (Maybe< T > maybe0, Maybe< T > maybe1) |
|
static bool | operator<= (Maybe< T > maybe0, Maybe< T > maybe1) |
|
static implicit | operator Maybe< T > (T t) |
|
static implicit | operator Maybe< T > (Maybe.NoneType none) |
|
A struct that represents a value that could or could not exist. Unlike the built-int nullable types, you are unable to access the value unless it does exist, and will never recieve a null value.
Definition at line 59 of file Maybe.cs.