Create the Distinct query : Distinct « LINQ « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;


public class MainClass{

   public static void Main(string[] args){   
         String[] First = { "One", "Two", "Two", "Three", "Four" };
         String[] Second = { "Three", "Four", "Five", "Six" };

         var ShowDistinct = First.Distinct();

         // Display the output.
         Console.WriteLine("Distinct:");
         foreach (String ThisElement in ShowDistinct)
            Console.WriteLine(ThisElement);

   }
}








22.31.Distinct
22.31.1.Create the Distinct query
22.31.2.Use Linq Distinct to get the distinct value in an array
22.31.3.Set Operators: Distinct
22.31.4.Printing the unique Category names
22.31.5.Distinct Operator
22.31.6.Get Distinct departments
22.31.7.Get all Make and don't show duplicates