【发布时间】:2017-06-01 16:08:01
【问题描述】:
我有两个长度相同的数组,我想使用它们的内容。当我保存到 json 文件时,数组 a 和 b 的 index[0] 应该一起使用。我猜我需要通过它们来访问每个索引并将内容保存到模板 json 中。我也希望它返回一个 toString() 格式的 json,所以每个索引的每次迭代都会返回一些东西。
public string Show(string[] id, string[] msg)
{
// opening code for json file with jobject and jsontexreader
for (int i = 0; i <= id.Length; i++ )
{
Newid = id[i];
Newmsg = msgs[i];
// setting the data to the json file
JObject temp = (JObject)o1.SelectToken(path1);
temp["data"] = msg;
JObject tem = (JObject)o1.SelectToken(path2);
tem["ksid"] = id;
}
return ??;
}
【问题讨论】:
-
您的实际问题是什么?这只是一个要求列表。
-
msg的长度是否有可能与id的长度不同?