Set Operators: Distinct : Distinct « LINQ « C# / CSharp Tutorial






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

public class MainClass {
    public static void Main() {

        int[] fl = { 2, 2, 3, 5, 5 };

        var uniqueFactors = fl.Distinct();

        Console.WriteLine("Prime factors of 300:");
        foreach (var f in uniqueFactors) {
            Console.WriteLine(f);
        }
    }
}








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