C# Program to Generate Numbers That Are Multiples of 5 Using the LINQ Parallel Query

What we are going to look at today is C# Program to Generate Numbers That Are Multiples of 5 Using the LINQ Parallel Query We are going to be very clear about this topic. We hope that all the skepticism on this topic will be resolved through this article.

C# Program to Generate Numbers That Are Multiples of 5 Using the LINQ Parallel Query

C# Program to Generate Numbers That Are Multiples of 5 Using the LINQ Parallel Query

//Program to generate numbers that are 
//multiples of 5 using LINQ parallel query.

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        IEnumerable<int> Numbers = ((ParallelQuery<int>)ParallelEnumerable.Range(1,30))
        .Where(num => num%5==0)
        .Select(val => val);

        foreach (int num in Numbers) 
        {
            Console.WriteLine(num); 
        }
    }
}
5
10
20
25
15
30
Press any key to continue . . .

Final Words

We hope you find the C# Program to Generate Numbers That Are Multiples of 5 Using the LINQ Parallel Query useful. And please let us know if you have any doubts about this article.

Hi, I'm Selva a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment