You can use LINQ to XML (which is preferable in latest .Net versions)
var xdoc = XDocument.Load(fileManager.ConfigFile);
var serverConfig = xdoc.Root;
string version = (string)serverConfig.Attribute("version");
DateTime date = (DateTime)serverConfig.Attribute("createDate");
string type = (string)serverConfig.Attribute("type");
var items = from item in serverConfig.Element("items").Elements()
select new {
Name = (string)item.Attribute("name"),
Type = (string)item.Attribute("type"),
Source = (string)item.Attribute("source"),
Destination = (string)item.Attribute("destination")
};
Take a look - few lines of code and file parsed into strongly-typed variables. Even date is a DateTime
object instead of string. And items are collection of anonymous objects with properties corresponding to xml attributes.