namespace ConsoleApplication
public static class Program
public static void Main ()
var numbers = Enumerable.Range(0, 20);
var parallelResult = numbers.AsParallel()
parallelResult.ForAll(e => Console.WriteLine(e));
catch (AggregateException e)
Console.WriteLine("Therewhere {0} exceptions", e.InnerExceptions.Count);
public static bool IsEven (int i)
if (i % 10 == 0) throw new ArgumentException("i");