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))); }
public virtual IOutcome <NoSuchElementException, TValue> Filter(Func <TValue, bool> filterFunction) { return(Failure.Of <NoSuchElementException, TValue>(new NoSuchElementException(_cause))); }
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)); }
public virtual IOutcome <TCause, TNextSuccess> AndThen <TNextSuccess>(Func <TValue, TNextSuccess> action) { return(Failure.Of <TCause, TNextSuccess>(_cause)); }
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)); }
public virtual IOutcome <TNextFailure, TValue> OtherwiseFail <TNextFailure>(Func <TCause, TNextFailure> action) where TNextFailure : Exception => Failure.Of <TNextFailure, TValue>(action.Invoke(cause));