public static void UsingContextPartitioner() { Random rnd = new Random(); WorkItem[] sourceData = new WorkItem[10000]; for (int i = 0; i < sourceData.Length; i++) { sourceData[i] = new WorkItem() { WorkDuration = rnd.Next(1, 11) }; } Partitioner <WorkItem> cPartitioner = new ContextPartitioner(sourceData, 100); Parallel.ForEach(cPartitioner, item => { item.performWork(); }); EndOfProgram(); }
public ChunkEnumerator(ContextPartitioner parent) { parentPartitioner = parent; }
public EnumerableSource(ContextPartitioner parent) { parentPartitioner = parent; }