Example for matching with actions:
var action = new MatchAction<string>
{
{"a", s => Console.WriteLine("pattern a")},
{s => s.StartsWith("d"), s => Console.WriteLine("pattern for string which starts with d ")},
{ Match.Default, s => Console.WriteLine("default action") },
{ Match.Null, s => Console.WriteLine("action for null") }
}.Action;
action("dummy");
Example for matching with funcs:
var func = new MatchAction<string>
{
{"a", s => "pattern a")},
{s => s.StartsWith("d"), s => "pattern for string which starts with d "},
{ Match.Default, s => "default action" },
{ Match.Null, s => "action for null" }
}.Func;
var result = func("dummy").Single();