1
2
3
4
5
 string xml = "<top><levels><number>4</number></levels></top>";
 XDocument xdoc = XDocument.Parse(xml);
 int levels = Convert.ToInt32(xdoc.Descendants("levels")
                                 .Single().Element("number").Value); 
 Console.WriteLine(levels);