Exemple #1
0
        private static void Main()
        {
            var rnd = new Random();

            var sourceData = new WorkItem[10000];

            for (var i = 0; i < sourceData.Length; i++)
            {
                sourceData[i] = new WorkItem(rnd.Next(1, 11));
            }

            // Создаем стратегию разбиения для конкретного типа
            Partitioner <WorkItem> contextualPartitioner = new ContextPartitioner(sourceData, 100);

            Parallel.ForEach(contextualPartitioner, item => { item.PerformWork(); });
        }
 public ChunkEnumerator(ContextPartitioner parentPartitioner)
 {
     _parentPartitioner = parentPartitioner;
 }
 public EnumerableSource(ContextPartitioner parentPartitioner)
 {
     _parentPartitioner = parentPartitioner;
 }