public MyFragment() { Input = new TransformationBlock <SomeMessage, SomeOther>(MyFunction); _finalBlock = new ActionBlock <SomeOther>(MyMethod); var linkOptions = new DataflowLinkOptions { PropagateCompletion = true } Input.LinkTo(_finalBlock, linkOptions); }
/// <summary> /// Creates a transformation that takes one input and produces one output for each. /// </summary> /// <typeparam name="TInput"></typeparam> /// <typeparam name="TOutput"></typeparam> /// <param name="transformation"></param> /// <param name="boundedCapacity"></param> /// <returns></returns> public virtual TransformationBlock <TInput, TInputMsg, TOutput, TOutputMsg> TransformationFor <TInput, TInputMsg, TOutput, TOutputMsg>( IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> transformation ) where TOutputMsg : IDataflowMessage <TOutput> where TInputMsg : IDataflowMessage <TInput> { var task = DecorateTaskWithDefaults(transformation); var options = CreateDefaultExecutionBlockOptions(); var block = new TransformationBlock <TInput, TInputMsg, TOutput, TOutputMsg>(this, task, options); m_CreatedBlocks.Add(block); return(block); }