Ejemplo n.º 1
0
        public ISourceDataflowBuilder <TOutput> WriteOnce(Func <TOutput, TOutput> cloningFunction, DataflowWriteOnceOptions writeOnceOptions)
        {
            if (cloningFunction == null)
            {
                throw new ArgumentNullException("cloningFunction");
            }

            var writeOnceBlock = new WriteOnceBlock <TOutput>(cloningFunction, writeOnceOptions.WriteOnceBlockOptions);

            LinkHelper.Link(_finalSourceBlock, writeOnceBlock, writeOnceOptions.LinkOptions);
            return(new SourceDataflowBuilder <TOutput>(_originalSourceBlock, _finalSourceBlock, writeOnceBlock, _propagateCompletion));
        }
Ejemplo n.º 2
0
        public ISourceDataflowBuilder <TOutput> WriteOnce(Func <TOutput, TOutput> cloningFunction, DataflowWriteOnceOptions writeOnceOptions = default(DataflowWriteOnceOptions))
        {
            if (cloningFunction == null)
            {
                throw new ArgumentNullException("cloningFunction");
            }

            var writeOnceBlock      = new WriteOnceBlock <TOutput>(cloningFunction, writeOnceOptions.WriteOnceBlockOptions);
            var propagateCompletion = Link(writeOnceBlock, writeOnceOptions.LinkOptions, null);
            var sourceWrapper       = new MultipleSourceDataflowWrapper(_sourceBlocks);

            return(new SourceDataflowBuilder <TOutput>(sourceWrapper, sourceWrapper, writeOnceBlock, propagateCompletion));
        }