Tutorial by Examples

(Collects 2-3 inputs and combines them into a Tuple) Like BatchBlock, JoinBlock<T1, T2, …> is able to group data from multiple data sources. In fact, that’s JoinBlock<T1, T2, …>’s primary purpose. For example, a JoinBlock<string, double, int> is an ISourceBlock<Tuple<strin...
(Copy an item and send the copies to every block that it’s linked to) Unlike BufferBlock, BroadcastBlock’s mission in life is to enable all targets linked from the block to get a copy of every element published, continually overwriting the “current” value with those propagated to it. Additionally,...
(Readonly variable: Memorizes its first data item and passes out copies of it as its output. Ignores all other data items) If BufferBlock is the most fundamental block in TPL Dataflow, WriteOnceBlock is the simplest. It stores at most one value, and once that value has been set, it will never be r...
(Collects a certain number of total items from 2-3 inputs and groups them into a Tuple of collections of data items) BatchedJoinBlock<T1, T2,…> is in a sense a combination of BatchBlock and JoinBlock<T1, T2,…>. Whereas JoinBlock<T1, T2,…> is used to aggregate one input from each ...
(Select, one-to-one) As with ActionBlock, TransformBlock<TInput, TOutput> enables the execution of a delegate to perform some action for each input datum; unlike with ActionBlock, this processing has an output. This delegate can be a Func<TInput, TOutput>, in which case processing of t...
(foreach) This class can be thought of logically as a buffer for data to be processed combined with tasks for processing that data, with the “dataflow block” managing both. In its most basic usage, we can instantiate an ActionBlock and “post” data to it; the delegate provided at the ActionBlock’s c...
(SelectMany, 1-m: The results of this mapping are “flattened”, just like LINQ’s SelectMany) TransformManyBlock<TInput, TOutput> is very similar to TransformBlock<TInput, TOutput>. The key difference is that whereas a TransformBlock<TInput, TOutput> produces one and only one outpu...
(Groups a certain number of sequential data items into collections of data items) BatchBlock combines N single items into one batch item, represented as an array of elements. An instance is created with a specific batch size, and the block then creates a batch as soon as it’s received that number o...
(FIFO Queue: The data that comes in is the data that goes out) In short, BufferBlock provides an unbounded or bounded buffer for storing instances of T. You can “post” instances of T to the block, which cause the data being posted to be stored in a first-in-first-out (FIFO) order by the block. Yo...

Page 1 of 1