Find the Greatest and Lowest number from a series of number using Anonymous Type in VB.Net.

Rajnilari2015
Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 238
The following example will do so

Dim numberCollection = New List(Of Integer)() From { _
14, _
25, _
23, _
64, _
4, _
35, _
26, _
19, _
100 _
}

' By using the max, min function of the generic collection
'Also observe the useage of Anonymous Type in C#
Dim result = New With { _
Key .GreatestNumber = intList.Max(), _
Key .LowestNumber = intList.Min() _
}

Console.WriteLine("Max= {0} Min={1}", result.GreatestNumber, result.LowestNumber)


Output
-------

Max= 100   Min=4

Comments or Responses

Login to post response