Skip to content

Latest commit

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Welcome to DataflowEx

DataflowEx is a collection of extensions to TPL Dataflow library with Object-Oriented Programming in mind. It does not replace TPL Dataflow but provides abstraction/management on top of dataflow blocks to make your life easier.

If you are not familiar with TPL Dataflow yet, please take your time to watch two videos:

Beginner (15min): http://channel9.msdn.com/posts/TPL-Dataflow-Tour

Advanced (63min): http://channel9.msdn.com/posts/TPL-Dataflow-Tour

And detailed documentation here: http://msdn.microsoft.com/en-us/library/hh228603(v=vs.110).aspx

So, what's wrong with TPL Dataflow? Nothing. The library from Microsoft library looks simply great. However, in the tough real world there are some obstacles when we apply RAW TPL Dataflow. Let's look at an example:

varsplitter=newTransformBlock<string,KeyValuePair<string,int>>(
input =>{varsplitted=input.Split('=');returnnewKeyValuePair<string,int>(splitted[0],int.Parse(splitted[1]));});vardict=newDictionary<string,int>();varaggregater=newActionBlock<KeyValuePair<string,int>>(
pair =>{intoldValue;dict[pair.Key]=dict.TryGetValue(pair.Key,outoldValue)?oldValue+pair.Value:pair.Value;});splitter.LinkTo(aggregater,newDataflowLinkOptions(){PropagateCompletion=true});splitter.Post("a=1");splitter.Post("b=2");splitter.Post("a=5");splitter.Complete();aggregater.Completion.Wait();Console.WriteLine("sum(a) = {0}",dict["a"]);//prints sum(a) = 6

About

This is karl's playground!

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors