public static SwitchResult <TResult, IEnumerable <T> > Switch <T, TResult>(this SwitchResult <TResult, IEnumerable <T> > arg, IEnumerable <T> checkValue, Func <IEnumerable <T>, TResult> func) { if (!arg.HasValue && (arg.Arg.IsNull() && checkValue.IsNull() || arg.Arg.NotNull() && arg.Arg.SeqEquals(checkValue))) { return(arg.SetValue(func(arg.Arg))); } return(arg); }
public static SwitchResult <TResult, T> Switch <T, TResult>(this SwitchResult <TResult, T> arg, Func <T, bool> check, Func <T, TResult> func) { if (!arg.HasValue && check(arg.Arg)) { return(arg.SetValue(func(arg.Arg))); } return(arg); }
public static SwitchResult <T> Switch <T>(this SwitchResult <T> arg, Func <T, bool> check, Action <T> func) { if (!arg.HasValue && check(arg.Arg)) { return(arg.Done(func)); } return(arg); }
public static SwitchResult <TResult, T> Switch <T, TResult>(this SwitchResult <TResult, T> arg, T checkValue, Func <T, TResult> func) { if (!arg.HasValue && (arg.Arg.IsNull() && checkValue.IsNull() || arg.Arg.NotNull() && arg.Arg.Equals(checkValue))) { return(arg.SetValue(func(arg.Arg))); } return(arg); }
public static SwitchResult <TResult, T> SwitchNotNull <T, TMiddle, TResult>(this SwitchResult <TResult, T> arg, Func <T, TMiddle> getValue, Func <TMiddle, TResult> func) { if (arg.HasValue) { return(arg); } TMiddle value = getValue(arg.Arg); if (value.NotNull()) { return(arg.SetValue(func(value))); } return(arg); }