您的位置:首页 > 产品设计 > UI/UE

C#将字典转换成name=value这种字符串格式

2016-04-08 21:09 393 查看
/// <summary>/// 将字典转换成name=value这种字符串格式/// </summary>/// <param name="dic"></param>/// <returns></returns>public static string DictionaryToStr(IDictionary<string,string> dic){//使用排序字典dic = new SortedDictionary<string, string>(dic);string strTemp = string.Empty;foreach (KeyValuePair<string, string> item in dic){if (!string.IsNullOrEmpty(item.Key) && !string.IsNullOrEmpty(item.Value)){strTemp += item.Key + "=" + item.Value + "&";}}strTemp = strTemp.TrimEnd('&');return strTemp;}
                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Dictionary