As the title says, I would like to know if there is a simple way to convert a multiple dimension array of double
numbers to the same array, but in int
numbers.
Of course we could have two(or more) for
loops going to each number and convert them, but I was wondering if there is a simple method to do it? :)
(By the way I am truly sorry if this question has already been asked a lot, but I didn't find any answer!)
Edit: As I lack a lot of informations: I have for example
double[,] tab1 = {{3.42,1.6523,42.42142},{42.124,932.241, 9.421}};
int[,] tab2;
And I would like to have at the end
tab2 = {{3,1,42}{42,932,9}}
Right now the code I have to do this is
for(int i=0; i<tab1.GetLength(0); i++){
for (int j=0; j<tab1.GetLength(1); j++) {
tab2[i,j] = (int)tab1[i,j];
}
}