Exemple #1
0
 public static void Default <TCase, TOther>(this SwithCase <TCase, TOther> sc, TOther other)
 {
     if (sc == null)
     {
         return;
     }
     sc.Action(other);
 }
Exemple #2
0
 public static SwithCase <TCase, TOther> Case <TCase, TOther>(this SwithCase <TCase, TOther> sc, Predicate <TCase> predict, TOther other, bool bBreak) where TCase : IEquatable <TCase>
 {
     if (sc == null)
     {
         return(null);
     }
     if (predict(sc.Value))
     {
         sc.Action(other);
         return(bBreak ? null : sc);
     }
     else
     {
         return(sc);
     }
 }