我想转换下面的代码
string[][] mergeData = new string[][] {
new string[] { "phone", "date"},
new string[] { "0421 3359 129", DateTime.Now.ToString() } };
至
Dictionary<string, string> list = new Dictionary<string, string>();
list.Add("phone", "0421 3359 129");
list.Add("date", DateTime.Now.ToString());
string[][] mergeData = new string[2][];
int i = 0;
foreach(KeyValuePair<string, string> pair in list)
{
mergeData[0][i] = pair.Key;
mergeData[1][i] = pair.Value;
i++;
}
但我收到错误消息
object reference not set to an instance of an object
我怀疑它与我的锯齿状数组初始化有关。我不知道如何正确启动锯齿状阵列。而且我必须使用锯齿状数组。
请帮忙。谢谢。