我正在尝试向Json流添加一些参数。但是,当我尝试WriteObject时,获得了一个重要的选择。我究竟做错了什么?
Stream responseStream = e.Result;
Params par = new Params();
par.id = "1";
par.jsonrpc = "2.0";
par.method = "getPosts";
par.param = new Param { page = "0"};
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Params));
ser.WriteObject(responseStream, par);
Params response = (Params)ser.ReadObject(responseStream);