获取错误“system.xml.xmldictionaryreader不包含CreateTextReader的定义”

时间:2012-08-07 17:56:30

标签: windows-phone-7

我收到错误system.xml.xmldictionaryreader在VS2010 Express for Windows手机上不包含'CreateTextReader'的定义。代码用于网页,它可以工作,然后我复制到我的手机应用程序。我添加了“System.Runtime.Serialization”和“using System.xml”作为参考。有人会告诉我如何解决这个问题。谢谢。

有一个类使用:

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

1 个答案:

答案 0 :(得分:0)

手机上的重载不是supported

首先在byte []数组中读取流,然后将CreateBinaryReader重载

输入