I have xml like that:
<Person>
<Person>
<Name>Asd</Name>
<Surname>Dsa/Surname>
<City>ASdasd</City>
</Person>
<Person>
<Name>Asadas</Name>
<Surname>Dsadsad</Surname>
<City>dsadsa</City>
</Person>
</Person>
Class Person:
public class Person
{
public string Name{ get; set; }
public string Surname{ get; set; }
public string City { get ; set; }
}
Function: public static void
SendTheLoadedPerson(ObservableCollection<ObservableCollection<Person>> list)
{
XmlRootAttribute oRootAttr = new XmlRootAttribute();
XDocument doc = XDocument.Parse(path);
var pepoleList= (from r in doc.Root.Elements("Person")
select new Person()
{
Name = (string)r.Element("Name"),
Surname = (string)r.Element("Surname"),
City = (string)r.Element("City")
}).ToList();
}
I would like to add every person to the list ObservableCollection> list But once I have no idea how to do that, than moreover the pepoleList returns empty Please could you tell me any tip? My case is diffrent than others because I have ObservableCollection> list others just have list of object