C# 获得Dictionary所有key和value值
Dictionary<string, string> dc = new Dictionary<string, string>(); dc.Add("code","codeValue"); dc.Add("name", "nameValue"); List<string> keyList = new List<string>(); List<string> valueList = new List<string>(); foreach (KeyValuePair<string, string> kvp in dc) { keyList.Add(kvp.Key); valueList.Add(dc[kvp.Key]); }