/// <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;

}