Using the .NET Partitioner class for creating units of work for your parallel or threaded operations

Posted: (EET/GMT+2)

 

The .NET class library is large and contains numerous useful classes, and thus you might find yourself thinking, whether a particular feature is in the library or not. Today, I wanted to give you a quick reminder on a class called Partitioner that allows you to partition ("slice") larger chunks of input data into smaller units, so that these smaller units can then be processed in multi-threaded and/or parallel fashion.

The Partitioner class contains several static methods that help you creating partitions from original set of data, for example an array. In case you need this kind of functionality – while not difficult to write yourself – be sure to check this class out.

Happy hacking!