Simple example C# with Example



Simple example C# with Example

This example shows how PLINQ can be used to calculate the even numbers between 1 and 10,000 using multiple 
threads. Note that the resulting list will won't be ordered! 
var sequence = Enumerable.Range(1, 10000); 
var evenNumbers = sequence.AsParallel() 
.Where(x => x % 2 == 0) 
.ToList(); 
// evenNumbers = { 4, 26, 28, 30, ... } 
// Order will vary with different runs 

0 Comment's

Comment Form