52
1
using System;
2
using System.Collections;
3
using System.Collections.Generic;
4
using System.Collections.Concurrent;
5
using System.Linq;
6
using System.Diagnostics;
7
using System.Threading.Tasks;
8
9
public class Program
10
{
11
public static void Main()
12
{
13
var limit = 2000000;
14
var numbers = Enumerable.Range(0, limit).ToList();
15
16
var watch = Stopwatch.StartNew();
17
var primeNumbers = GetPrimeList(numbers);
18
watch.Stop();
19
20
var watch2 = Stopwatch.StartNew();
21
var primeNumbersFromParallel = GetPrimeListWithParallel(numbers);
22
23
24
Console.WriteLine($"Using Normal ForLoop, Total Time: {watch.ElapsedMilliseconds}, Total Prime: {primeNumbers.Count}");
Cached Result
directory not found exception handled
Tasks Exception: ArgumentNullException Value cannot be null. (Parameter 'path')
Tasks Exception: ArgumentNullException Value cannot be null. (Parameter 'path')