/// <summary>
/// 拼接 Get请求参数
/// </summary>
/// <param name="parames"></param>
/// <returns></returns>
private static Tuple<string, string> GetQueryString(Dictionary<string, string> parames)
{
StringBuilder query = new StringBuilder("");
StringBuilder queryStr = new StringBuilder("");
if (parames == null || parames.Count == 0)
return new Tuple<string, string>("", "");
foreach (var item in parames)
{
string key = item.Key;
string value = item.Value;
if (!string.IsNullOrEmpty(key))
{
query.Append(key).Append(value);
queryStr.Append("&").Append(key).Append("=").Append(value);
}
}
return new Tuple<string, string>(query.ToString(), queryStr.ToString().Substring(1, queryStr.Length - 1));
}
请发表评论