コード例 #1
0
ファイル: IMatchSwitchExtensions.cs プロジェクト: wastaz/with
 //
 public static T Case <T, In, NothingOrPrepared>(this MatchCollector <T, In, NothingOrPrepared> that,
                                                 In expected, Action <In> result)
 {
     return(that.Add(new MatchSingle <In, NothingOrPrepared>(
                         expected,
                         F.ReturnDefault <In, NothingOrPrepared>(result))));
 }
コード例 #2
0
ファイル: IMatchSwitchExtensions.cs プロジェクト: wastaz/with
 public static T Case <T, In, NothingOrPrepared>(this MatchCollector <T, In, NothingOrPrepared> that,
                                                 Func <In, bool> expected, Action result)
 {
     return(that.Add(new Match <In, NothingOrPrepared>(
                         expected,
                         F.ReturnDefault <In, NothingOrPrepared>(F.IgnoreInput <In>(result)))));
 }
コード例 #3
0
        public static T Regex <T, Out>(this MatchCollector <T, string, Out> that,
                                       string expected,
                                       Func <Out> result)
        {
            var regex = new Regex(expected);

            return(that.Regex(regex, result));
        }
コード例 #4
0
 public static T Regex <T, Out>(this MatchCollector <T, string, Out> that,
                                Regex expected,
                                Func <Out> result)
 {
     return(that.Add(new Match <string, Out>(
                         expected.IsMatch,
                         F.IgnoreInput <string, Out>(result))));
 }
コード例 #5
0
 public static T Regex <T, NothingOrPrepared>(this MatchCollector <T, string, NothingOrPrepared> that,
                                              Regex expected,
                                              Action <Match> result)
 {
     return(that.Add(new Match <string, NothingOrPrepared>(
                         expected.IsMatch,
                         F.ReturnDefault <string, NothingOrPrepared>(i => result(expected.Match(i))))));
 }
コード例 #6
0
        public static T Regex <T, NothingOrPrepared>(this MatchCollector <T, string, NothingOrPrepared> that,
                                                     string expected,
                                                     Action result)
        {
            var regex = new Regex(expected);

            return(that.Regex(regex, result));
        }
コード例 #7
0
 public static T Regex <T, NothingOrPrepared>(this MatchCollector <T, string, NothingOrPrepared> that,
                                              Regex expected,
                                              Action result)
 {
     return(that.Add(new Match <string, NothingOrPrepared>(
                         expected.IsMatch,
                         F.ReturnDefault <string, NothingOrPrepared>(F.IgnoreInput <string>(result)))));
 }
コード例 #8
0
        public static T Fields <T, In, Out>(this MatchCollector <T, In, Out> that, Action <MatchFields <In, Out> > fields)
        {
            var m = new MatchFields <In, Out>();

            m.Fields = true;
            fields(m);
            return(that.Add(new SwitchMatchFields <In, Out>(m.Funcs.ToArray(), m.TypeOfFields)));
        }
コード例 #9
0
        public static T Regex <T, Out>(this MatchCollector <T, string, Out> that,
                                       string expected,
                                       RegexOptions options,
                                       Out result)
        {
            var regex = new Regex(expected, options);

            return(that.Regex(regex, result));
        }
コード例 #10
0
 public static T Regex <T, Out>(this MatchCollector <T, string, Out> that,
                                Regex expected,
                                Func <Match, Out> result)
 {
     return(that.Add(new Match <string, Out>(expected.IsMatch, i => result(expected.Match(i)))));
 }
コード例 #11
0
ファイル: IMatchSwitchExtensions.cs プロジェクト: wastaz/with
 public static T Else <T, In>(this MatchCollector <T, In, Prepared> that,
                              Action <In> result)
 {
     return(that.Add(new MatchElse <In, Prepared>(
                         F.ReturnDefault <In, Prepared>(result))));
 }
コード例 #12
0
ファイル: TypeSwitchExtensions.cs プロジェクト: wastaz/with
 public static T Case <T, On, In>(
     this MatchCollector <T, In, Nothing> that, Action <On> func)
     where On : In
 {
     return(that.Add(new MatchType <On, In, Nothing>(F.ReturnDefault <On, Nothing>(func))));
 }