I want to find the minimum and maximum values ββof this array. At one point, it is set to (512, 512) UShorts. And for the cycle there would be a lot of time for this, a lot of points, and I'm looking for something cleaner. SelectMany happened to me, but I donβt know how to implement it.
Dim usResult As UShort(,)
edit: I tried
Dim minValue As UShort = UShort.MaxValue Dim maxValue As UShort = UShort.MinValue Dim sw As New Stopwatch() sw.Start() For i As Integer = 0 To 511 Step 1 For j As Integer = 0 To 511 Step 1 minValue = Math.Min(usResult(i, j), minValue) maxValue = Math.Max(usResult(i, j), maxValue) Next Next sw.Stop() Console.WriteLine(sw.ElapsedMilliseconds) ' This takes 2 to 3 milliseconds
source share