Method Match
- Namespace
- SodaFlow.Functional
- Assembly
- SodaFlow.Functional.dll
Match<T>(Func<T1, T>, Func<T2, T>, Func<T3, T>, Func<T4, T>)
Runs one of the four functions depending on which case is held, and returns its result.
public T Match<T>(Func<T1, T> onFirst, Func<T2, T> onSecond, Func<T3, T> onThird, Func<T4, T> onFourth)
Parameters
onFirstFunc<T1, T>Run with the value when the first case is held.
onSecondFunc<T2, T>Run with the value when the second case is held.
onThirdFunc<T3, T>Run with the value when the third case is held.
onFourthFunc<T4, T>Run with the value when the fourth case is held.
Returns
- T
Whatever the function that was run returned.
Type Parameters
TThe type each of the functions returns.
Remarks
This is the only member that reads the held value, and it expresses each other member here. This calls one function of the set, and it calls that function before this method returns.