Mega Code Archive

 
Categories / VB.Net / LINQ
 

Using Aggregating Count to get the number of unique factors of 300

Imports System.IO Imports System.Reflection Imports System.Linq Imports System.Xml.Linq Public Class MainClass    Public Shared Sub Main         Dim f = New Integer() {2, 2, 3, 5, 5}         Dim uniqueFactors = f .Distinct().Count()         Console.WriteLine("There are " & uniqueFactors & " unique factors of 300.")    End Sub End Class