Professional Documents
Culture Documents
LINQ
This C# Program Generates Odd Numbers in Parallel using LINQ. Here it Provides a set of
methods for querying objects that implement ParallelQuery{TSource} to generate odd numbers
inparallel.
Here is source code of the C# Program to Generate Odd Numbers in Parallel using
LINQ. The C# program is successfully compiled and executed with Microsoft Visual
Studio. The program output is also shown below.
1 /*
2
*/
4 using System;
5 using System.Linq;
6 using System.Collections.Generic;
7
8 class Program
9 {
10
11
{
IEnumerable<int> oddNums =
12
((ParallelQuery<int>)ParallelEnumerable.Range(20, 2000))
13
.Where(x => x % 2 != 0)
14
15
16
Console.ReadLine();
17
18 }