01AJressie
New Member
I have come across a problem, I need to basicly deserialize this:\[code\]<?xml version="1.0" encoding="UTF-8"?><api_data> <status>ok</status> <sessions> <id>2</id> <sessionID>6bfd1f1a7e87a8a6ed476234ad1d6e86</sessionID> <gameID>1</gameID> <maxPlayers>8</maxPlayers> <hostIP>12.0.0.1</hostIP> <hostPort>1993</hostPort> <inProgress>0</inProgress> <timestamp>1358894690</timestamp> </sessions> <sessions> <id>3</id> <sessionID>eeb4dc2df32f885c2b7d13f28a246830</sessionID> <gameID>1</gameID> <maxPlayers>8</maxPlayers> <hostIP>12.0.0.1</hostIP> <hostPort>1993</hostPort> <inProgress>0</inProgress> <timestamp>1358894732</timestamp> </sessions></api_data>\[/code\]And I need to convert that to usable data, its also dynamic, so there could be more than just 2 session elements, there could be 4, 20, or 0, the code I have now is just broken, and I was wondering whats a good method to get this to work?Currently I am up to the point of the XDocument class, with all this loaded.And I need to return a multi-dimensional array with this data.EDIT:Current code, completely broken:\[code\]var xmlSessions = xmlDATA.Descendants("api_data").Elements("sessions").Select(x => x);result = new string[xmlDATA.Descendants("api_data").Count(), 7];\[/code\]EDIT 2: More infoThe way I was thinking the MultiDimensional Array would be is as follows:\[code\]array[0,0] "ok" //Statusarray[1,0 to 7] //First Session details go herearray[2,0 to 7] //Second session details go here, and so forth.\[/code\]