Represents an optional value.
More...
Inherited by FaunaDB.Types.None< T >, and FaunaDB.Types.Some< T >.
|
IOption< U > | Map< U > (Func< T, U > func) |
| Apply the function passed on the optional value. More...
|
|
IOption< U > | FlatMap< U > (Func< T, IOption< U >> func) |
| Apply the function passed on the optional value. More...
|
|
U | Match< U > (Func< T, U > Some, Func< U > None) |
| Matches the current instance. Case it contains some value it will execute the first argument. Case it contains none value it will execute the second argument. More...
|
|
void | Match (Action< T > Some, Action None) |
| Matches the current instance. Case it contains some value it will execute the first argument. Case it contains none value it will execute the second argument. More...
|
|
Represents an optional value.
Definition at line 8 of file Option.cs.
◆ FlatMap< U >()
Apply the function passed on the optional value.
- Parameters
-
func | the map function to be applied |
- Returns
- If this is a some value, return a new optional with the function applied to it. If this is a none value, returns none and ignore the function.
◆ Map< U >()
Apply the function passed on the optional value.
- Parameters
-
func | the map function to be applied |
- Returns
- If this is a some value, return a new optional with the function applied to it. If this is a none value, returns none and ignore the function.
◆ Match()
Matches the current instance. Case it contains some value it will execute the first argument. Case it contains none value it will execute the second argument.
IOption<string> optional = ...
result.Match( Some: value => DoSomething(value), None: () => DoSomethingElse() );
- Parameters
-
Some | Function to be executed case this instance contains some value |
None | Function to be executed case this instance contains none value |
◆ Match< U >()
Matches the current instance. Case it contains some value it will execute the first argument. Case it contains none value it will execute the second argument.
IOption<string> optional = ...
int parsed = result.Match( Some: value => int.Parse(value), None: () => ReturnDefaultValue() );
- Parameters
-
Some | Function to be executed case this instance contains some value |
None | Function to be executed case this instance contains none value |
◆ Value
The documentation for this interface was generated from the following file:
- /tmp/build/1a4543b4/fauna-csharp-repository/FaunaDB.Client/Types/Option.cs