ForgeDocs
Documentation for the forge framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Forge.Utilities.Maybe< T > Struct Template Reference

Maybe wraps another type and is used to signal to other code that it might not return a result. It performs the same function as null, but in a more type-safe manner that provides more clarity into the contract that function exhibits. More...

Public Member Functions

 Maybe (T value)
 Creates a new Maybe container that holds the given value. More...
 
override string ToString ()
 

Static Public Attributes

static readonly Maybe< T > Empty = new Maybe<T>(default(T), false)
 Default empty instance. More...
 

Properties

Value [get]
 Gets the underlying value. More...
 
bool Exists [get]
 Returns true if this Maybe has a value stored in it. More...
 
bool IsEmpty [get]
 Returns true if this Maybe is empty, it, it does not have a value stored in it. More...
 

Detailed Description

Maybe wraps another type and is used to signal to other code that it might not return a result. It performs the same function as null, but in a more type-safe manner that provides more clarity into the contract that function exhibits.

Template Parameters
TThe type of value stored in the Maybe instance

Constructor & Destructor Documentation

Forge.Utilities.Maybe< T >.Maybe ( value)

Creates a new Maybe container that holds the given value.

Member Data Documentation

readonly Maybe<T> Forge.Utilities.Maybe< T >.Empty = new Maybe<T>(default(T), false)
static

Default empty instance.

Property Documentation

bool Forge.Utilities.Maybe< T >.Exists
get

Returns true if this Maybe has a value stored in it.

bool Forge.Utilities.Maybe< T >.IsEmpty
get

Returns true if this Maybe is empty, it, it does not have a value stored in it.

T Forge.Utilities.Maybe< T >.Value
get

Gets the underlying value.

If IsEmpty returns true, then this method will throw an InvalidOperationException.


The documentation for this struct was generated from the following file: