Is it possible to remove the inner loop by assigning data.Data.Tables[0].Rows[i].ItemArray directly?
object[,] arr = new object[52784, 21];
for (int i = 0; i < data.Data.Tables[0].Rows.Count; i++)
{
for (int j = 0; j < data.Data.Tables[0].Columns.Count; j++)
{
arr[i, j] = data.Data.Tables[0].Rows[i][j];
}
}
The reason why I need this code is because, I want to write to data of this dataTable to Excel using Interop which requires a 2-D array as input.