could someone please help me with my begginers problem?
I code that reads XML and stores it into a class.
Now i am struuggeling how to read data from that class. What i need is accessing data in class based on
attribute "id".
My code
class Program { public static string Document = ""; static void Main(string[] args) { Program.XmlParse(); Console.ReadLine(); } public static void XmlParse() { XDocument doc = XDocument.Parse(Document); IEnumerable<XmlParseObject> result = from c in doc.Descendants("HotSpot") select new XmlParseObject() { Id = (int)(c.Attribute("id")), x = (float)c.Attribute("x"), y = (float)c.Attribute("y"), z = (float)c.Attribute("z") }; } } public class XmlParseObject { public float x { get; set; } public float y { get; set; } public float z { get; set; } public int Id { get; set; } }