예제 #1
0
        /// <summary>
        /// Makes a link from <paramref name="source"/> to <paramref name="target"/> and returns an encapsulated target block.
        /// </summary>
        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="target"/> is <see langword="null"/>.</exception>
        public static ITargetBlock <TInput> ChainToTarget <TInput, TOutput>(this IPropagatorBlock <TInput, TOutput> source, ITargetBlock <TOutput> target)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            source.LinkWithCompletion(target);
            return(EncapsulateAsTargetBlock(source, target));
        }
예제 #2
0
        /// <summary>
        /// Makes a link from <paramref name="source"/> to <paramref name="follower"/> and returns an encapsulated block.
        /// </summary>
        /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="follower"/> is <see langword="null"/>.</exception>
        public static IPropagatorBlock <TInput, TOutput> Chain <TInput, TSourceOutput, TOutput>(
            this IPropagatorBlock <TInput, TSourceOutput> source,
            IPropagatorBlock <TSourceOutput, TOutput> follower)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (follower == null)
            {
                throw new ArgumentNullException(nameof(follower));
            }

            source.LinkWithCompletion(follower);
            return(EncapsulateAsPropagatorBlock(source, follower));
        }