public static string[][] Info_work;
……
Info_work[0] = line.Split(new char[] { ',' });//为什么提示说未处理请教一下,多重数组如果想给Info_work[]附上一个string[]类型的数组可以么?
ps:info_work[]=string[] aaa;对么?运行起来似乎是不对,求教,该怎么来写呢?
……
Info_work[0] = line.Split(new char[] { ',' });//为什么提示说未处理请教一下,多重数组如果想给Info_work[]附上一个string[]类型的数组可以么?
ps:info_work[]=string[] aaa;对么?运行起来似乎是不对,求教,该怎么来写呢?
第一维没有初始化
示例:string[][] temp = new string[3][];
temp[0] = new string[5];
temp[1] = new string[3];
temp[2] = new string[4];
for (int i = 0; i < temp.Length; i++)
{
MessageBox.Show(temp[i].Length.ToString());
}
int[] a1 = new int[2];//默认值为0;
int[] a2 = new int[]{1,2};
//初始化等长二维数据
int [,] ab1 = new int [2,3];//默认值为0;
int [,] ab2 = new int [2,3]{{1,2,3},{4,5,6}};
//初始化不等长二维数据
int [][] abc = new int [2][];
abc[0] = new int[]{1,2};
abc[1] = new int[]{3,4,5,6};//一步步初始化更有助于理解;
string[][] ColumnName = new string[3][];
ColumnName[0] = new string[1] { "aaa"};
ColumnName[1] = new string[] {"aaa","bbb" };
ColumnName[2] = new string[3] {"aaa","bbb","ccc" };