0
我試圖反序列化字符串: 「"{\"Id\":1,\"Ent\":\"TUROS\",\"Data\":\"2010-09-09\",\"Ap\":\"004510875954\",\"Mat\":\"1129\"}"
」 的一個對象,但我抓住這個錯誤:錯誤在反序列化在Windows Phone 7
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);
}
它的作品DataContractJsonSerializer,我需要添加System.ServiceModel.Web.dll到我的參考:)。非常感謝。 – kaub0st3r