/// <summary> /// If false... /// </summary> /// <param name="this"></param> /// <param name="action"></param> /// <param name="context"></param> public static void IfFalse <T>(this BooleanVal2 @this, Action <T> action, T context) { if (@this is not null && @this.IsT1()) { action?.Invoke(context); } }
/// <summary> /// If false... /// </summary> /// <param name="this"></param> /// <param name="action"></param> public static void IfFalse(this BooleanVal2 @this, Action action) { if (@this is not null && @this.IsT1()) { action?.Invoke(); } }
/// <summary> /// If this then that... /// </summary> /// <typeparam name="TValue"></typeparam> /// <param name="condition"></param> /// <param name="this"></param> /// <param name="that"></param> /// <returns></returns> public static TValue Ifttt <TValue>(this BooleanVal2 condition, Func <TValue> @this, Func <TValue> @that) { if (condition is null) { return(default);
/// <summary> /// If this then that... /// </summary> /// <param name="condition"></param> /// <param name="this"></param> /// <param name="that"></param> public static void Ifttt(this BooleanVal2 condition, Action @this, Action that) { condition?.Switch( _ => @this?.Invoke(), _ => that?.Invoke()); }