/// <summary> /// Adds the given <paramref name="binder"/> to this Try's call sequence. /// </summary> public AsyncTry <U> ThenAsync <U>(Func <Task <U> > binder) { TryThrowHelper.VerifyBinderNotNull(binder); var frame = new AsyncTryFrame(TryFrameType.Action, async x => await binder().ConfigureAwait(false), null); return(new AsyncTry <U>(Frames.Add(frame))); }
/// <summary> /// Adds the given <paramref name="binder"/> to this Try's call sequence. /// </summary> public AsyncTry <U> Then <U>(Func <U> binder) { TryThrowHelper.VerifyBinderNotNull(binder); var frame = new AsyncTryFrame(TryFrameType.Action, async x => binder(), null); return(new AsyncTry <U>(Frames.Add(frame))); }
/// <summary> /// Adds the given <paramref name="binder"/> to this Try's call-sequence. /// </summary> public Try <U> Then <U>(Func <T, U> binder) { TryThrowHelper.VerifyBinderNotNull(binder); var frame = new SyncTryFrame(TryFrameType.Action, x => binder((T)x), null); return(new Try <U>(Frames.Add(frame))); }
/// <summary> /// Adds the given <paramref name="binder"/> to this Try's call-sequence. /// </summary> public AsyncTry <U> ThenAsync <U>(Func <T, Task <U> > binder) { TryThrowHelper.VerifyBinderNotNull(binder); var asyncFrames = Frames .ToAsync() .Add(new AsyncTryFrame(TryFrameType.Action, async x => await binder((T)x).ConfigureAwait(false), null)); return(new AsyncTry <U>(asyncFrames)); }