我想降级的 Windows移动有由应用程序的 .NET Framework精简3.5 .NET Framework精简2.0 SP2

不过......我不知道如何使这块代码兼容2.0版本。

XDocument doc = XDocument.Load(string.Format(Open_Cell_Id_Uri, new object[]{
    Settings.OpenCellIDApiKey,
    towerDetails.MobileCountryCode, 
    towerDetails.MobileNetworkCode, 
    towerDetails.TowerId,
    towerDetails.LocationAreaCode
    }));

using (System.Xml.XmlReader reader = doc.CreateReader())
{
     ...
}

我改变使用System.Xml.Linq的使用的System.Xml但此行抱怨:

using (System.Xml.XmlReader reader = doc.CreateReader())

如何从一个XmlDocument的获得的XmlReader?

这是我已经降级的代码:

XmlDocument doc = new XmlDocument();
    doc.Load(string.Format(Open_Cell_Id_Uri, new object[]{
    Settings.OpenCellIDApiKey,
    towerDetails.MobileCountryCode, 
    towerDetails.MobileNetworkCode, 
    towerDetails.TowerId,
    towerDetails.LocationAreaCode
    }));

using (System.Xml.XmlReader reader = doc.CreateReader())//;
{
    ...
}

谢谢!

有帮助吗?

解决方案

要创建节点读取器:

using (XmlReader reader = new XmlNodeReader(doc.DocumentElement)) {...}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top