internal XmlLightAttributes(IEnumerable <XmlLightAttribute> list)
        {
            _attributes = new Dictionary <string, XmlLightAttribute>(StringComparer.OrdinalIgnoreCase);
            int index = 0;

            foreach (XmlLightAttribute attribute in list)
            {
                XmlLightAttribute a = attribute;
                a.Ordinal = index++;
                _attributes.Add(a.Name, a);
            }
        }
 /// <summary>
 /// Removes an item from the collection
 /// </summary>
 public bool Remove(string name)
 {
     if (_attributes.Remove(name))
     {
         int index = 0;
         foreach (XmlLightAttribute attr in ByOrdinal)
         {
             XmlLightAttribute a = attr;
             a.Ordinal           = index++;
             _attributes[a.Name] = a;
         }
         return(true);
     }
     return(false);
 }
 /// <summary>
 /// Gets or Sets the attribute's unencoded text value
 /// </summary>
 public string this[string name]
 {
     get
     {
         return(HttpUtility.HtmlDecode(_attributes[name].Value));
     }
     set
     {
         XmlLightAttribute a;
         if (!_attributes.TryGetValue(name, out a))
         {
             a         = new XmlLightAttribute(name);
             a.Ordinal = _attributes.Count;
         }
         else if (a.Quote == XmlQuoteStyle.None || a.Quote == XmlQuoteStyle.Missing)
         {
             a.Quote = XmlQuoteStyle.Double;
         }
         a.Value           = HttpUtility.HtmlAttributeEncode(value);
         _attributes[name] = a;
     }
 }