سؤال

اريد انخفض ويندوز موبايل تطبيق صنع مع .NET Framework المدمجة 3.5 ل .NET Framework 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())

كيف يمكنني الحصول على XMLReader من xmldocument؟

هذا هو الكود الذي قمت بتخفيضه:

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