Exemple #1
0
        /// <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)));
        }
Exemple #2
0
        /// <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)));
        }
Exemple #3
0
        internal AsyncTry(Func <Task <T> > action)
        {
            var frame = new AsyncTryFrame(TryFrameType.Action, async _ => await action().ConfigureAwait(false), null);

            _frames = AsyncTryFrames.Empty.Add(frame);
        }