M
Macin
Hi, what is wrong with this method? When I run program I get the error:
"Specified cast is not valid." for the statement: temp =
(double[,])lista[n]. The list lista[n] is a list of 2 dimensional arrays of
a size 8x8. Thanks for help
public double[,] wyswietlMacierzWilekosciObrazka(ArrayList lista)
{
double[,] duza = new double[wys,szer];
int n=0;
for (int k=0;k<wys;k+=8)
{
for (int l=0;l<szer;l+=8)
{
double[,] temp = new double[8,8]; temp = (double[,])lista[n];
n+=1;
for (int i=0;i<8;i++)
{
for (int j=0;j<8;j++)
{
duza[i+k,l+j]=temp[i,j];
}
}
}
}
return duza;
}
"Specified cast is not valid." for the statement: temp =
(double[,])lista[n]. The list lista[n] is a list of 2 dimensional arrays of
a size 8x8. Thanks for help
public double[,] wyswietlMacierzWilekosciObrazka(ArrayList lista)
{
double[,] duza = new double[wys,szer];
int n=0;
for (int k=0;k<wys;k+=8)
{
for (int l=0;l<szer;l+=8)
{
double[,] temp = new double[8,8]; temp = (double[,])lista[n];
n+=1;
for (int i=0;i<8;i++)
{
for (int j=0;j<8;j++)
{
duza[i+k,l+j]=temp[i,j];
}
}
}
}
return duza;
}