コード例 #1
0
 /// <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);
     }
 }
コード例 #2
0
 /// <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();
     }
 }
コード例 #3
0
 /// <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);
コード例 #4
0
 /// <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());
 }