C# SortedDictionary根据值进行排序:
var query = dic.OrderBy(t => t.Value).ToDictionary(t => t.Key, t => t.Value);
public string GetWxCardSign(SortedDictionary<string, object> dic) { var query = dic.OrderBy(t => t.Value).ToDictionary(t => t.Key, t => t.Value); StringBuilder sb = new StringBuilder(); foreach (KeyValuePair<string, object> temp in query) { if (temp.Value == null) { continue; } else if (temp.Value.ToString() == "" || temp.Key.ToLower() == "sign") { continue; } sb.Append(temp.Value); } string signkey = Helper.Helper.SHA1(sb.ToString()); return signkey; }