public void ReadXml(Xml.XmlReader reader) { bool wasEmpty = reader.IsEmptyElement; reader.Read(); if (wasEmpty) { return; } while (reader.NodeType != Xml.XmlNodeType.EndElement) { string key = reader.GetAttribute("key"); string value = reader.GetAttribute("value"); this.Add((TKey)Convert.ChangeType(key, typeof(TKey)), (TValue)Convert.ChangeType(value, typeof(TValue))); reader.Read(); reader.MoveToContent(); } reader.ReadEndElement(); }
void IXmlSerializable.ReadXml(Xml.XmlReader reader) { this.ResourceKey = reader.GetAttribute("name"); this.Value = (ResourceValue)reader.ReadContentAs(typeof(ResourceValue), null); }