Method ValueOr
ValueOr<T>(Maybe<T>, T)
Returns the value of the Maybe{T} instance if it is non-empty, otherwise returns value.
Declaration
public static T ValueOr<T>(this Maybe<T> source, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| Maybe<T> | source | The Mabye{T} instance whose value is returned if it is not empty. |
| T | value | The value to return if the Maybe{T} is empty. |
Returns
| Type | Description |
|---|---|
| T | Either the value of Maybe{T} or |
Type Parameters
| Name | Description |
|---|---|
| T | The sub-type of the Maybe{T} instances. |
ValueOr<T>(Maybe<T>, Func<T>)
Returns the value of the Maybe{T} instance if it is non-empty, otherwise returns the result of the valueFactory function.
Declaration
public static T ValueOr<T>(this Maybe<T> source, Func<T> valueFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| Maybe<T> | source | The Mabye{T} instance whose value is returned if it is not empty. |
| Func<T> | valueFactory | A function the is used to calculate the return value if |
Returns
| Type | Description |
|---|---|
| T | Either the value of |
Type Parameters
| Name | Description |
|---|---|
| T | The sub-type of the Maybe{T} instances. |