我正在尝试将这个字符串:“ "{\"Id\":1,\"Ent\":\"TUROS\",\"Data\":\"2010-09-09\",\"Ap\":\"004510875954\",\"Mat\":\"1129\"}"
”反序列化为一个对象,但我发现了这个错误:
There was an error deserializing the object of type Seguro. Data at the root level is invalid. Line 1, position 1.
我的代码:
private void sendPostCompleted(object sender, UploadStringCompletedEventArgs e)
{
// Handle result
var status = e.Result;
byte[] data = Encoding.UTF8.GetBytes(status);
MemoryStream memStream = new MemoryStream(data);
DataContractSerializer serializer = new DataContractSerializer(typeof(Seguro));
Seguro car = (Seguro)serializer.ReadObject(memStream);
}