Post 使用 HttpClient 的复杂数据类型
Post complex data type using HttpClient
I need to post an object of class like>
class A{
public string dataitem1{get;set;}
public byte[] dataitem2{get;set;}
}
I need to post the object of this class to webAPI using Windows Store App 8.1. I tried many solutions but could not find anyone working. Can somebody provide help by code or link to working demo. I'm trying to implement full MVVM structure
I Found one demo here but not working in my case
通过将对象转换为 json 字符串,您可以传输 json 对象。
您可以使用 JavaScriptSerializer
class:
using System.Web.Script.Serialization;
var json = new JavaScriptSerializer().Serialize(obj);
然后你可以return来自webapi的对象。
I need to post an object of class like>
class A{
public string dataitem1{get;set;}
public byte[] dataitem2{get;set;}
}
I need to post the object of this class to webAPI using Windows Store App 8.1. I tried many solutions but could not find anyone working. Can somebody provide help by code or link to working demo. I'm trying to implement full MVVM structure
I Found one demo here but not working in my case
通过将对象转换为 json 字符串,您可以传输 json 对象。
您可以使用 JavaScriptSerializer
class:
using System.Web.Script.Serialization;
var json = new JavaScriptSerializer().Serialize(obj);
然后你可以return来自webapi的对象。