XML
<?xml version="1.0" encoding="utf-8"?>
<DeviceIdMappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Devices>
<DeviceEntry>
<Key>907579560</Key>
<Value>SEMROUTER</Value>
</DeviceEntry>
</Devices>
</DeviceIdMappings>
КОД
string filename = @"C:\Users\Desktop\DeviceMapping.xml";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = true;
xmlDoc.Load(filename);
var xml = XElement.Load(filename);
Dictionary<uint, string> MasterDeviceMappings = (from x in xml.Descendants("DeviceEntry")
select new
{
Key = x.Element("Key").Value,
Value = x.Element("Value").Value,
}
).ToDictionary(q => uint.Parse(q.Key), q => q.Value);
Исключение System.FormatException: 'Входная строка была в неправильном формате.'
Понятия не имею, что здесь не так. uint.Parse ("907579560") работает.