public static void Else <T, U>(this MatchVoid <T, U> @this, Action <T> action) { if (@this != null) { action(@this.Value); } }
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); }
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); }
public static MatchVoid <T, U> Switch <T, U>(this T @this, Func <T, U> predicate) => MatchVoid <T, U> .Of(@this, predicate);