Fortunately, it is just a debugger problem, and on the device it is working.
Von: [email protected] [mailto:[email protected]] Im Auftrag von Jon Hopkins Gesendet: 24 August 2011 16:16 Cc: [email protected] Betreff: [MonoTouch] Xml Linq bug Hi, I have a class that I use to store a recursive object that is populated via Linq from Xml. The code is pretty Simple and works in Visual Studio, but in MT, the sub-objects exist but are garbage collected and NULL When you inspect them. using System; using System.Xml.Linq; using System.Collections.Generic; using System.Linq; public class pageObj { public string bgImage = ""; ...... public List<pageObj> subpages; public pageObj() { } public pageObj(XElement el) { if (el.Element("bgimage") != null) bgImage = el.Element("bgimage").Value ?? ""; ........... if (el.Element("subpages") != null) { var myref = subpages; // try and keep a ref subpages = el.Element("subpages") .Descendants("subpage") .Select(e => new pageObj(e)) .ToList(); } } } ..... Initialised with pages = xmlDoc .XPathSelectElements("magazine/page") .Select(e => new pageObj(e)) .ToList(); Thanks, Jon
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
