double[] tab = new double[10];
I know I can gen minimum by tab.Min()
.
double[,] tab = new double[10,2];
This is table of coordinates, in 2nd index 0 is x and 1 is y. There are 10 points.
How can I get minimum (and maximum) value of x and y?
In other words:
minX
is the smallest value in 1st column (second index=0 e.g tab[xxx, 0]
);minY
is the smallest value in 2nd column (second index=1 e.g tab[xxx, 1]
);
var doubles = new double[4,2]{{1,2},{4,5},{7,8},{9,1}};
var min = System.Linq.Enumerable.Range(0, 4).Select(i => doubles[i, 1]).Min();
OR
var doubles = new double[4,2]{{1,2},{4,5},{7,8},{9,1}};
var min = System.Linq.Enumerable.Range(0, doubles.GetUpperBound(0)+1)
.Select(i => doubles[i, 1]).Min();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With