예제 #1
0
        public virtual IOutcome <NoSuchElementException, TValue> Filter(Func <TValue, bool> filterFunction)
        {
            if (filterFunction.Invoke(value))
            {
                return(Success.Of <NoSuchElementException, TValue>(value));
            }

            return(Failure.Of <NoSuchElementException, TValue>(new NoSuchElementException($"{value}, null", null)));
        }
예제 #2
0
 public virtual IOutcome <NoSuchElementException, TValue> Filter(Func <TValue, bool> filterFunction)
 {
     return(Failure.Of <NoSuchElementException, TValue>(new NoSuchElementException(_cause)));
 }
예제 #3
0
 public virtual IOutcome <TNextFailure, TNextSuccess> AndThenTo <TNextFailure, TNextSuccess>(Func <TValue, IOutcome <TNextFailure, TNextSuccess> > action) where TNextFailure : Exception
 {
     return(Failure.Of <TNextFailure, TNextSuccess>((TNextFailure)(Exception)_cause));
 }
예제 #4
0
 public virtual IOutcome <TCause, TNextSuccess> AndThen <TNextSuccess>(Func <TValue, TNextSuccess> action)
 {
     return(Failure.Of <TCause, TNextSuccess>(_cause));
 }
예제 #5
0
 public virtual IOutcome <TCause, Tuple <TValue, TSecondSuccess> > AlongWith <TOtherFailure, TSecondSuccess>(IOutcome <TOtherFailure, TSecondSuccess> outcome) where TOtherFailure : Exception
 {
     return(Failure.Of <TCause, Tuple <TValue, TSecondSuccess> >(_cause));
 }
예제 #6
0
 public virtual IOutcome <TNextFailure, TValue> OtherwiseFail <TNextFailure>(Func <TCause, TNextFailure> action)
     where TNextFailure : Exception
 => Failure.Of <TNextFailure, TValue>(action.Invoke(cause));