예제 #1
0
        static void Main(string[] args)
        {
            var exampleToRun = ExamplesEnumeration.ParallelLinq;

            switch (exampleToRun)
            {
            case ExamplesEnumeration.Invoke:
                InvokeExamples.ShowInvoke();
                break;

            case ExamplesEnumeration.InvokeWithOptions:
                InvokeExamples.ShowInvokeWithOptions();
                break;

            case ExamplesEnumeration.For:
                ForExample.ShowFor();
                break;

            case ExamplesEnumeration.ForEach:
                ForEachExample.ShowForEach();
                break;

            case ExamplesEnumeration.ParallelLinq:
                ParallelLinqExample.ShowParallelLinq();
                break;
            }

            Console.Read();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Parallel Linq example");
            var pe = new ParallelLinqExample();
            pe.Run();
            Console.WriteLine();

            Console.WriteLine("Preserving order with Parallel Linq");
            var ope = new OrderedParallelLinqExample();
            ope.Run();
            Console.WriteLine();

            Console.WriteLine("Cancellation example");
            var ce = new CancellationExample();
            ce.Run();
            Console.WriteLine();

            Console.WriteLine("Parallel aggregations");
            var pae = new ParallelAggregationExample();
            pae.Run();
            Console.WriteLine();
        }