public static void ElseFailWith <In>(this SwitchWithInstance <In, Nothing> that, Func <In, Exception> generator) { var els = that.Add(new MatchElse <In, Nothing>( F.ReturnDefault <In, Nothing>(@in => { throw generator(@in); }))); Nothing value; els.TryMatch(out value); }
public static void Else <In>(this SwitchWithInstance <In, Nothing> that, Action <In> result) { var els = that.Add(new MatchElse <In, Nothing>( F.ReturnDefault <In, Nothing>(result))); Nothing value; els.TryMatch(out value); }
public static Out Result <In, Out>(this SwitchWithInstance <In, Out> that) { return(that.Value()); }
public static void ElseFail <In>(this SwitchWithInstance <In, Nothing> that) { that.ElseFailWith(@in => new Exception("Failed to match")); }