Exemple #1
0
 /// <summary>
 /// Provides a fluent matcher that ultimately (upon Exec() being called) invokes the Action
 /// associated with the match.
 /// </summary>
 public IOptionActionMatcher <T> Match() => Option.Match();
Exemple #2
0
 public static Option <TOutput> Map <TInput, TOutput>(this Option <TInput> input, Func <TInput, TOutput> f) =>
 input.Match <Option <TOutput> >()
 .Some().Do(x => f(x).Into(Option <TOutput> .Some))
 .None().Do(Option <TOutput> .None())
 .Result();
Exemple #3
0
 /// <summary>
 /// Provides a fluent matcher that ultimately (upon Result() being called) returns a TResult value
 /// by invoking the function associated with the match.
 /// </summary>
 public IOptionFuncMatcher <T, TResult> Match <TResult>() => Option.Match <TResult>();
Exemple #4
0
 public static Option <T> Flatten <T>(this Option <Option <T> > option) =>
 option.Match <Option <T> >()
 .Some().Do(x => x)
 .None().Do(Option <T> .None())
 .Result();