Exemplo n.º 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();
        }
Exemplo n.º 2
0
 public ChunkEnumerator(ContextPartitioner parent)
 {
     parentPartitioner = parent;
 }
Exemplo n.º 3
0
 public EnumerableSource(ContextPartitioner parent)
 {
     parentPartitioner = parent;
 }