public override void ReadXml(XmlReader reader) { if (null == reader) { throw new ArgumentNullException("reader"); } if (reader.EOF) { throw new ArgumentException("reader is at EOF"); } reader.MoveToElement(); base.ReadXml(reader); reader.MoveToContent(); int elementDepth = reader.Depth; if (reader.ReadToDescendant("attributes")) { this.EnsureAttributes(); if (reader.ReadToDescendant("attribute")) { int depth = reader.Depth; do { ConfigurationElementAttribute attribute = new ConfigurationElementAttribute(string.Empty); attribute.ReadXml(reader); this._attributes.Add(attribute.ConfigKey, attribute); reader.MoveToElement(); while (depth < reader.Depth && reader.Read()) { } } while (reader.ReadToNextSibling("attribute")); } } while (elementDepth < reader.Depth - 1 && reader.Read()) { } if (reader.ReadToNextSibling("elements")) { this.EnsureElements(); if (reader.ReadToDescendant("element")) { int depth = reader.Depth; do { ConfigurationElement element = new ConfigurationElement(string.Empty); element.ReadXml(reader); this._elements.Add(element.ConfigKey, element); reader.MoveToElement(); while (depth < reader.Depth && reader.Read()) { } } while (reader.ReadToNextSibling("element")); } } }
public IConfigurationElement Clone() { ConfigurationElement clone = new ConfigurationElement(this.ConfigKey); clone.ConfigKey = this.ConfigKey; clone.Attributes = this.Attributes.Clone(clone); clone.Elements = this.Elements.Clone(clone); return clone; }