Пример #1
0
 public override MaybeNotNull <R> SelectMany <K, R>(Func <T, MaybeNotNull <K> > maybeSelector, Func <T, K, R> resultSelector)
 {
     try
     {
         var k = maybeSelector(this.Value);
         if (k.Kind == MaybeKind.Value)
         {
             var res = resultSelector(this.Value, k.Value);
             return(isNull(res) ? MaybeNotNull <R> .MakeNull() : MaybeNotNull <R> .MakeValue(res));
         }
         else
         {
             return(k.SelectMany <R, R>(null, null));
         }
     }
     catch (Exception ex)
     {
         return(MaybeNotNull <R> .MakeError(ex));
     }
 }
Пример #2
0
 public static MaybeNotNull <T> Throw <T>(Exception ex)
 {
     return(MaybeNotNull <T> .MakeError(ex));
 }