Beispiel #1
0
 /// <summary>
 /// 中身がある時と無い時で処理を行う
 /// </summary>
 /// <param name="then"></param>
 /// <param name="elseThen"></param>
 public void IfPresent(Action <T> then, Action elseThen)
 {
     if (HasValue)
     {
         NullCheck.DoAction(Value, then);
     }
     else
     {
         elseThen();
     }
 }
Beispiel #2
0
 /// <summary>
 /// 中身を代替を指定して取得
 /// </summary>
 /// <typeparam name="U"></typeparam>
 /// <param name="value"></param>
 /// <returns></returns>
 public T OrElse <U>(U value)
     where U : T
 => HasValue?NullCheck.DoAction(Value, Functional.Id) : value;
Beispiel #3
0
 /// <summary>
 /// 中身がある時と無い時で処理を行う
 /// </summary>
 /// <param name="then"></param>
 /// <param name="elseThen"></param>
 public U IfPresent <U>(Func <T, U> then, Func <U> elseThen)
 => HasValue
         ? NullCheck.DoAction(Value, then)
         : elseThen();