مرحبًا ، أستخدم RestSharp في مشروع Windows Phone 7.1 الخاص بي.
لدي إجابة بتنسيق XML هنا:
https://skydrive.live.com/redir.aspx؟cid=0b39f4fbbb0489dd&resid=B39F4FBBB0489DD!139 & parid = B39F4FBBB0489DD! 103 & authkey =! AOdT-FiS6Mw8v5Y
حاولت إلغاء تسلسل هذا الرد إلى فصل دراسي:
public class fullWall
{
public _user user { get; set; }
public int numberOfFriend { get; set; }
public int numberOfPhoto { get; set; }
public List<timhotPhotos> timhotPhotos { get; set; }
public fullWall()
{
timhotPhotos = new List<timhotPhotos>();
}
}
جميع الخصائص على ما يرام باستثناء قائمة timhotPhotos
، كما ترى هنا:
فئة timhotPhotos:
public class timhotPhotos
{
public string id { get; set; }
public string title { get; set; }
public string description { get; set; }
public string url { get; set; }
public double width { get; set; }
public double height { get; set; }
public DateTime createdDate { get; set; }
public _user user { get; set; }
public int numOfComment { get; set; }
public int numOfRate { get; set; }
public int numOfView { get; set; }
public bool rated { get; set; }
}
أين أنا مخطئ؟
رأيت سؤالك في StackOverflow ، وتم الرد عليه ، والآن نسخ إجابتي إلى هنا:
سيتعين عليك تغيير أداة إلغاء تسلسل XML الافتراضية إلى DotNetXmlDeserializer ، مثل هذا:
RestClient client;
client.AddHandler("application/xml", new DotNetXmlDeserializer());
ثم قم بإضافة سمة XmlElement إلى القائمة
public class fullWall
{
public _user user { get; set; }
public int numberOfFriend { get; set; }
public int numberOfPhoto { get; set; }
[System.Xml.Serialization.XmlElement()]
public List<timhotPhotos> timhotPhotos { get; set; }
public fullWall()
{
timhotPhotos = new List<timhotPhotos>();
}
}
الآن يجب أن تعمل بشكل جيد!
وبما أنك قبلت الإجابة في StackOverflow ، فسأمضي قدمًا وأغلق هذه المشكلة! ؛)
شكرا :)
ملاحظة: أنا فتاة تبلغ من العمر 21 عامًا ، سعدت بلقائك :)
التعليق الأكثر فائدة
شكرا :)
ملاحظة: أنا فتاة تبلغ من العمر 21 عامًا ، سعدت بلقائك :)