XML : Object reference not set to an instance of an object - exaption

XmlDocument xml = new XmlDocument(); XDocument doc = XDocument.Load(@"C:\Xml.xml");

i`ll try to load xml document, but i got "Object reference not set to an instance of an object." exaption on that.

the main purpose is to make a list from all the objects in the xml with AllUsers = doc.Descendants("EventUser").Select(d => new EventUser { Name = d.Element("Name").Value, Day = doc.Element("Day").Value, Month = doc.Element("Month").Value, Year = doc.Element("Year").Value }).ToList();

No comments:

Post a Comment