I have xml file which has structure like this
<CarsList>
<Country>France</Country>
<Cars>
<Car>
<Name>Alfa romeo</Name>
<Url>/carurl.htm</Url>
<Place>Marseille</Place>
</Car>
<Car>
<Name>Aston martin</Name>
<Url>/car2url.htm</Url>
<Place>Paris</Place>
</Car>
...
</Cars>
<CarsList>
inside c# code after loading file into memory I'm trying to read all car nodes and store into new object (CarInDetail) using following code
var cars = from c in elem.Descendants("Car")
select new CarInDetail
{
Name = c.Element("Name").Value
};
but I'm getting cars as null
No comments:
Post a Comment