Given the other answers, it's really easy to write your own ConvertAll
method for 2D arrays:
public static TOutput[,] ConvertAll<TInput, TOutput>(TInput[,] array, Func<TInput, TOutput> converter)
{
var result = new TOutput[array.GetLength(0), array.GetLength(1)];
for (int i = 0; i < array.GetLength(0); ++i)
for (int j = 0; j < array.GetLength(1); ++j)
result[i, j] = converter(array[i, j]);
return result;
}
Just because the authors of .NET didn't care to include this method, there's no need to give up entirely. It's pretty straight forward to write it yourself.
(You could make it an extension method if you wanted.)
EDIT after comments: If you really want to handle arrays whose lower bound (in some dimension) is not zero, it goes like this:
public static TOutput[,] ConvertAll<TInput, TOutput>(TInput[,] array, Func<TInput, TOutput> converter)
{
int xMin = array.GetLowerBound(0);
int xLen = array.GetLength(0);
int yMin = array.GetLowerBound(1);
int yLen = array.GetLength(1);
var result = (TOutput[,])Array.CreateInstance(typeof(TOutput), new[] { xLen, yLen, }, new[] { xMin, yMin, });
for (int x = xMin; x < xMin + xLen; ++x)
for (int y = yMin; y < yMin + yLen; ++y)
result[x, y] = converter(array[x, y]);
return result;
}