Exemplo n.º 1
0
        /// <summary>
        /// Adds a target block to send messages to.
        /// </summary>
        /// <returns>
        /// An object that can be used to destroy the link to the added target.
        /// </returns>
        public IDisposable AddTarget(ITargetBlock <T> targetBlock, DataflowLinkOptions linkOptions)
        {
            if (targetBlock == null)
            {
                throw new ArgumentNullException("targetBlock");
            }
            if (linkOptions == null)
            {
                throw new ArgumentNullException("linkOptions");
            }

            var result = Targets.AddTarget(targetBlock, linkOptions);

            EnsureProcessing();
            return(result);
        }