I have an obeservable collection _kidlist and I want to create an XML doc with 1 parent node Daddy and a child node for each kid.
I’m a complete noob when it comes to LINQ to xml but how would I do this?
When I iterate the collection I get a Parent node Daddy for eacht child but I want one parent node and N kid nodes
foreach (kiddo _kid in _kidlist)
{
XElement Daddy = new XElement( "Daddy",
new XElement( "Kid"),
new XElement( "Name", _kid.Name),
new XElement( "Age", _kid.Age )));
}
Thanks in advance,
Mike
1 Answer