i have problem:
string[,] a = string[27,27];
a = bootsrapMinor(data);
string[,] b = string[27,27];
b = bootstrapMayor(data);
string[,] c = a + b;
the error message is "Operator '+' cannot be applied to operands of type 'string[ , ]' and 'string[ , ]' "
anyone have solutions for my problem in joining 2 dimensional array if string? thanks alot.
You can't just "add" two arrays, because the '+' operator is not defined for arrays; you need two nested for
loops:
string[,] c = new string[27, 27];
for (int i = 0; i < 27; i++)
{
for (int j = 0; j < 27; j++)
{
c[i, j] = a[i, j] + b[i, j];
}
}
OK, I misunderstood your question...
This should work:
string[,] c = new string[54, 27];
for (int i = 0; i < 27; i++)
{
for (int j = 0; j < 27; j++)
{
c[i, j] = a[i, j];
c[27 + i, j] = b[i, j];
}
}
for (int i=0;i<27;i++)
for (int j=0;j<27;j++)
c[i,j] = a [i,j] + b[i,j];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.