I have xml file like
<House> <Name>some name</Name> <Price>22223</Price> </House> I'm loading file using XElement and I'm selecting it's elements
XElement elem = XElement.Load(fileName); var houseElements = from h in elem.Elements() select h; question is: how to access values inside each element inside this file I tried with
model.Name = houseElements.Where(x => x.Name == "Name").Select(x => x.Value).ToString(); model.Price= Convert.ToInt16(houseElements.Where(x => x.Name == "Price").Select(x => x.Value)); but this doesn't work
No comments:
Post a Comment