コード例 #1
0
 public static void Else <T, U>(this MatchVoid <T, U> @this, Action <T> action)
 {
     if (@this != null)
     {
         action(@this.Value);
     }
 }
コード例 #2
0
 public static MatchVoid <T, U> Case <T, U>(this MatchVoid <T, U> @this, U @that, Action <T> action)
 {
     if (@this == null)
     {
         return(@this);
     }
     if (@this.Predicate(@this.Value).Equals(@that))
     {
         action(@this.Value);
         return(null);
     }
     return(@this);
 }
コード例 #3
0
 public static MatchVoid <T, U> Case <T, U>(this MatchVoid <T, U> @this, Predicate <T> condition, Action <T> action)
 {
     if (@this == null)
     {
         return(@this);
     }
     if (condition(@this.Value))
     {
         action(@this.Value);
         return(null);
     }
     return(@this);
 }
コード例 #4
0
 public static MatchVoid <T, U> Switch <T, U>(this T @this, Func <T, U> predicate) => MatchVoid <T, U> .Of(@this, predicate);