Tips and tricks for .NET using ASP and VB code.

Get minimum and maximum values from an array

Dim NumberArray() As Double = {1, 2, 3, 9, 8, 7, System.Math.PI}
If NumberArray.Length > 0 Then
Dim SortArray() As Double = NumberArray.Clone
Array.Sort(SortArray)
Dim MinValue As Double = SortArray(0)
Dim MaxValue As Double = SortArray(SortArray.Length - 1)
SortArray = Nothing
End If

No comments:

Post a Comment

Search This Blog