Saturday, November 14, 2009

Fx 4.0 Parallel Extension

There are three primitives for Parallelism in Fx 4.0: Task, Paralle.For and PLINQ.

Task t1= new Task(delegate)
t1.Start()
t1.Wait()

Parallel.For(0,100, i=> { }); // lampta expression

IEnumerable nums = Enumerable.Range(0,10000);
IEnumeralbe results= from n in nums.AsParallel()
where testcondition(n)
select n