/// <summary>
 /// 转换为FormUrlEncodedContent对象
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public static HttpContent ToFormUrlEncodedContent <T>(this T data) where T : class
 {
     if (data is string)
     {
         return(new FormUrlEncodedContent(JsonKeyValuePair.Deserialize(data.ToString())));
     }
     else
     {
         return(new FormUrlEncodedContent(JsonKeyValuePair.BuidKeyValues(data)));
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 转换为FormUrlEncodedContent对象
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public static HttpContent ToFormUrlEncodedContent <T>(this T data) where T : class
 {
     return(new FormUrlEncodedContent(JsonKeyValuePair.Deserialize(data)));
 }