Pregunta

Quiero rebajar un Windows Mobile aplicación hecha con .Net Compact Framework 3.5 .Net Compact Framework 2.0 SP2 .

Pero ... No sé cómo hacer esta pieza de código compatible con la versión 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())
{
     ...
}

He cambiado usando System.Xml.Linq con el uso de System.XML pero esta línea se queja:

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

¿Cómo puedo obtener un XmlReader de un XmlDocument?

Este es el código que he rebajó:

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())//;
{
    ...
}

Gracias!

¿Fue útil?

Solución

Para crear un lector de nodo:

using (XmlReader reader = new XmlNodeReader(doc.DocumentElement)) {...}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top