I got the error system.xml.xmldictionaryreader does not contain a definition for ‘CreateTextReader’ on the VS2010 Express for Windows phone. The code is used for webpage and it works, then I copied into my phone application. I had added “System.Runtime.Serialization” and “using System.xml” as reference. Would someone show me how to solve this problem. Thanks.
There are the class as using:
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.Xml;
using System.Text;
using System.IO.IsolatedStorage;
public static T Deserializer<T>(Stream s)
{
//Get results
var ser = new DataContractSerializer(typeof(T));
var reader = XmlDictionaryReader.CreateTextReader(s,
new System.Xml.XmlDictionaryReaderQuotas());
ser = new DataContractSerializer(typeof(T));
var deserializedItem = (T)ser.ReadObject(reader, true);
reader.Close();
return deserializedItem;
}
#endregion
That overload is not supported on the phone.
Read the stream in a byte[] array first and then feed it the CreateBinaryReader overload