第2个回答 2013-10-26
string[][] fn=new string[12][];
fn[0]=new string[]{...}
fn[1]=new string[]{...}
...
fn[11]=new string[]{...}//这些写了吗
string[][] fn=new string[12][];
这一句只声明了包含12个string类型的一维数组的引用变量的一维数组。c#中数组是对象,必须实例化。
fn[0]=new string[]{...}
fn[1]=new string[]{...}
...
fn[11]=new string[]{...}
这些就是实例化每个string型一维数组。初始化可以写在大括号内。
二维数组是这样的
string[,] fn=new string[m,n]//m,n为常量表达式