C# Program to Demonstrate the Example of LINQ Distinct() Method

Thanks for reading my article first. C# Program to Demonstrate the Example of LINQ Distinct() Method We are going to learn more about this in this article. Let’s go into the article

C# Program to Demonstrate the Example of LINQ Distinct() Method

C# Program to Demonstrate the Example of LINQ Distinct() Method

//C# program to demonstrate Linq Distinct() method.

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

class Demo
{
    static void Main(string[] args)
    {
        List<int> Numbers = new List<int>() { 10, 20, 20, 30, 40, 40, 10, 50, 60 };


        var result = Numbers.Distinct();

        foreach (var distinct in result)
        {
            Console.WriteLine(distinct + " ");
        } 
    }
}
10
20
30
40
50
60
Press any key to continue . . .

Final Words

C# Program to Demonstrate the Example of LINQ Distinct() Method We hope this article solves all your doubts. If in doubt let me know.

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

Share on:

Leave a Comment