private TransformSafeBlock(IPropagatorBlock <Either <TLeft, TRightInput>, Either <TLeft, TRightOutput> > transformRightBlock) { this.transformRightBlock = transformRightBlock; this.transformRightBlock.LinkTo(outputBufferBlock.AddInput(), new DataflowLinkOptions { PropagateCompletion = true }); transformLeftBlock.LinkTo(outputBufferBlock.AddInput(), new DataflowLinkOptions { PropagateCompletion = true }); }
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)); }