Пример #1
0
 public static MatchValue <T, U, R> Case <T, U, R>(this MatchValue <T, U, R> @this, U @that, Func <T, R> action)
 {
     if (@this.HasResult)
     {
         return(@this);
     }
     if (@this.Predicate(@this.Value).Equals(@that))
     {
         return(MatchValue <T, U, R> .Of(@this.Value, @this.Predicate, action(@this.Value)));
     }
     return(@this);
 }
Пример #2
0
 public static MatchValue <T, U, R> Case <T, U, R>(this MatchValue <T, U, R> @this, Predicate <T> condition, Func <T, R> action)
 {
     if (@this.HasResult)
     {
         return(@this);
     }
     if (condition(@this.Value))
     {
         return(MatchValue <T, U, R> .Of(@this.Value, @this.Predicate, action(@this.Value)));
     }
     return(@this);
 }
Пример #3
0
 public static MatchValue <T, U, R> Switch <T, U, R>(this T @this, Func <T, U> predicate) => MatchValue <T, U, R> .Of(@this, predicate);