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

            source.LinkWithCompletion(target);
            return(EncapsulateAsDataflowBlock(source, target));
        }
Example #2
0
        public static IDisposable IgnoreOutput <TData>(this ISourceBlock <TData> source)
        {
            var terminateBlock = DataflowBlock.NullTarget <TData>(); // Never completes

            return(source.LinkWithCompletion(terminateBlock));
        }