internal static object CreateStatic(object parent, XmlNode section, string keyAttriuteName, string valueAttributeName) { ReadOnlyNameValueCollection result; if (parent == null) { result = new ReadOnlyNameValueCollection(new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture), new CaseInsensitiveComparer(CultureInfo.InvariantCulture)); } else { result = new ReadOnlyNameValueCollection((ReadOnlyNameValueCollection)parent); } HandlerBase.CheckForUnrecognizedAttributes(section); foreach (XmlNode child in section.ChildNodes) { if (HandlerBase.IsIgnorableAlsoCheckForNonElement(child)) { continue; } if (child.Name == "add") { string key = HandlerBase.RemoveRequiredAttribute(child, keyAttriuteName); string val = HandlerBase.RemoveRequiredAttribute(child, valueAttributeName, true); HandlerBase.CheckForUnrecognizedAttributes(child); result[key] = val; } else if (child.Name == "remove") { string key = HandlerBase.RemoveRequiredAttribute(child, keyAttriuteName); HandlerBase.CheckForUnrecognizedAttributes(child); result.Remove(key); } else if (child.Name.Equals("clear")) { HandlerBase.CheckForUnrecognizedAttributes(child); result.Clear(); } else { HandlerBase.ThrowUnrecognizedElement(child); } } result.SetReadOnly(); return(result); }
public ReadOnlyNameValueCollection(ReadOnlyNameValueCollection value) : base(value) { }