Use Aggregate Operators : Count : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » Count »

 

Use Aggregate Operators








    
 

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

public class MainClass {
    public static void Main() {
        int[] factorsOf300 = { 2, 2, 3, 5, 5 };

        int uniqueFactors = factorsOf300.Distinct().Count();

        Console.WriteLine("There are {0} unique factors of 300.", uniqueFactors);
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» Count