我的代码在这里。但我得到两个错误。数组初始化器只能用于变量或字段初始化器。尝试改用新表达式。
using System;
public class twoDimArray
{
public static void Main(string[] args)
{
String[] city=new String[] { {"NewYork","Muscat","London"} ,{"Cairo","Beijing","CapeTown"} };
for (int i=0; i<2; i++)
{for (int j=0; j<3; j++)
{
System.Console.Write(city[i][j]+"\t");
}
System.Console.Write("\n");
}
}
}