C# Newtonsoft_JSON 如何循环取出KEY和VALUE
发布网友
发布时间:2022-05-24 05:58
我来回答
共2个回答
热心网友
时间:2023-10-01 18:46
SortedDictionary<string, string> keyList = new SortedDictionary<string, string>();
foreach (JProperty jToken in JObject.Parse(paramStr).Properties())
{
keyList.Add(jToken.Name.ToString(), jToken.Value.ToString());
}
热心网友
时间:2023-10-01 18:47
SortedList<string, string> STK = new SortedList<string, string>();
STK.Add("1", "2");
STK.Add("3", "4");
foreach (KeyValuePair<string,string> item in STK)
{
Console.Write(string.Format("{0}:{1}",item.Key,item.Value));
}