Wednesday, August 3, 2011

LINQ - Aggregate Operators

Below code is to show the unique value:


Public Sub LinqSample1()
    Dim arr
Distinct() = {1, 1, 1, 2, 2, 3, 4, 4, 5, 5}

    Dim strUniqueFactors = 
arrDistinct.Distinct().Count()

    Console.WriteLine(
strUniqueFactors & " is unique value.")
End Sub



Result:
is unique value.