Example #1
0
        public static MaybeNotNull <T> Catch <T, TException>(this MaybeNotNull <T> source, Func <TException, T> getValue)
            where TException : Exception
        {
            //Contract.Requires( source != null );
            //Contract.Ensures( //Contract.Result<MaybeNotNull<T>>() != null );

            return(source.Catch((TException ex) => Maybe.Value(getValue(ex))));
        }
Example #2
0
 public static MaybeNotNull <T> Catch <T>(this MaybeNotNull <T> source, T defaultValue)
 {
     //Contract.Requires( source != null );
     //Contract.Ensures( //Contract.Result<MaybeNotNull<T>>() != null );
     return(source.Catch(Maybe.Value(defaultValue)));
 }