Obtaining the min and max of a two-dimensional array using LINQ
This seems to work:
IEnumerable<int> allValues = myArray.Cast<int>();
int min = allValues.Min();
int max = allValues.Max();
here is variant:
var maxarr = (from int v in aarray select v).Max();
where aarray is int[,]
Since Array implements IEnumerable
you can just do this:
var arr = new int[2, 2] {{1,2}, {3, 4}};
int max = arr.Cast<int>().Max(); //or Min