Table of Contents

Method Match

Namespace
SodaFlow.Functional
Assembly
SodaFlow.Functional.dll

Match<TResult>(Func<T, TResult>, Func<TResult>)

Runs one function when there is a value, and a different one when there is none.

public TResult Match<TResult>(Func<T, TResult> onSome, Func<TResult> onNone)

Parameters

onSome Func<T, TResult>

Run with the contained value when there is one.

onNone Func<TResult>

Run when there is no value.

Returns

TResult

Whatever the function that was run returned.

Type Parameters

TResult

The type each of the two functions returns.

Remarks

This is the only member that reads the contained value, and it expresses each other member here. This calls one function of the two, before this method returns.