标签:
1 private static string GetSortedParas(Dictionary<string, string> dic) 2 { 3 dic = dic.OrderBy(key => key.Key).ToDictionary(keyItem => keyItem.Key, valueItem => valueItem.Value); 4 var sbPara = new StringBuilder(1024); 5 foreach (var para in dic.Where(para => !para.Value.IsNullOrWhiteSpace())) 6 { 7 sbPara.AppendFormat("{0}={1}&", para.Key, para.Value); 8 } 9 return sbPara.ToString().TrimEnd(‘&‘); 10 }
C#代码实现对HTTP POST参数进行排序
标签:
原文地址:http://www.cnblogs.com/frankyou/p/5909688.html