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