Beispiel #1
0
        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();
        }
Beispiel #2
0
 public ChunkEnumerator(ContextPartitioner parent)
 {
     parentPartitioner = parent;
 }
Beispiel #3
0
 public EnumerableSource(ContextPartitioner parent)
 {
     parentPartitioner = parent;
 }