Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
 public static Out Result <In, Out>(this SwitchWithInstance <In, Out> that)
 {
     return(that.Value());
 }
Пример #4
0
 public static void ElseFail <In>(this SwitchWithInstance <In, Nothing> that)
 {
     that.ElseFailWith(@in => new Exception("Failed to match"));
 }