Exemplo n.º 1
0
        private static IPropagatorBlock <ISourceBlock <T>, T> CreateConcatBlock <T>(ISourceBlock <ISourceBlock <T> > source)
        {
            JointPointBlock <T> sourceBlock = new JointPointBlock <T>();
            ITargetBlock <ISourceBlock <T> > targetBlock = new ActionBlock <ISourceBlock <T> >(block =>
            {
                block.LinkTo(sourceBlock.AddInput(), new DataflowLinkOptions {
                    PropagateCompletion = true
                });
            });

            targetBlock.PropagateCompletionTo(sourceBlock.AddInput());
            return(DataflowBlock.Encapsulate(targetBlock, sourceBlock));
        }