我试图存储到锯齿状数组中的整数数组:
while (dr5.Read())
{
customer_id[i] = int.Parse(dr5["customer_id"].ToString());
i++;
}
dr5 是一个数据读取器。我将 customer_id 存储在一个数组中,我还想将分数存储在另一个数组中。我想在while循环中有类似下面的东西
int[] customer_id = { 1, 2 };
int[] score = { 3, 4};
int[][] final_array = { customer_id, score };
谁能帮帮我?编辑:这是我尝试过的。没有显示任何值。
customer_id = new int[count];
score = new int[count];
int i = 0;
while (dr5.Read())
{
customer_id[i] = int.Parse(dr5["customer_id"].ToString());
score[i] = 32;
i++;
}
int[][] final = { customer_id, score };
return this.final;