来源(null)

From: http://www.asm32.net/

// C# 字符串数组初始化和元素数量

string[][] array1 = null;
string[,] array2 = null;

string cache = "54:MySQL\n68:IT生活\n81:IT评论\n57:REFERRENCE 参考\n60:生活频道\n53:手机频道\n9:UNIX/LINUX\n16:JAVASCRIPT\n18:ISAPI";
string[] list = cache.Split(new Char[]{'\n'});

array1 = new string[list.Length][];
for(int i=0; i<list.Length; i++){
    string[] list1 = list[i].Split(new Char[]{':'}, 2);
    array1[i] = new string[2]{list1[0], list1[1]};
}
// array1.Length=9  array1[0].Length=2

array2 = new string[list.Length, 2];
for(int i=0; i<list.Length; i++){
    string[] list1 = list[i].Split(new Char[]{':'}, 2);
    array2[i, 0] = list1[0];
    array2[i, 1] = list1[1];
}
// array2.GetLength(0)=9  array2.GetLength(1)=2


string[][] array3 = new string[][]{new string[2]{"68", "IT生活"},
                         new string[2]{"81", "IT评论"},
                         new string[2]{"57", "REFERRENCE 参考"},
                         new string[2]{"60", "生活频道"},
                         new string[2]{"53", "手机频道"},
                         new string[2]{"9", "UNIX/LINUX"},
                         new string[2]{"16", "JAVASCRIPT"},
                         new string[2]{"18", "ISAPI"},
                         new string[2]{"10", "HTML"}};
// array3.Length=9  array3[0].Length=2

string[,] array4 = new string[9, 2]{{"68", "IT生活"},
                         {"81", "IT评论"},
                         {"57", "REFERRENCE 参考"},
                         {"60", "生活频道"},
                         {"53", "手机频道"},
                         {"9", "UNIX/LINUX"},
                         {"16", "JAVASCRIPT"},
                         {"18", "ISAPI"},
                         {"10", "HTML"}};
// array4.GetLength(0)=9  array4.GetLength(1)=2

Link: http://www.asm32.net/article_details.aspx?id=6085