public void Add(string key, string value)
 {
     if (string.IsNullOrEmpty(key))
     {
         throw new ArgumentNullException("key");
     }
     if (this._table == null)
     {
         this.ParseString();
     }
     this._table[key] = value;
     if (this._intTable != null)
     {
         HtmlTextWriterStyle styleKey = CssTextWriter.GetStyleKey(key);
         if (styleKey != ~HtmlTextWriterStyle.BackgroundColor)
         {
             this._intTable.Remove(styleKey);
         }
     }
     if (this._state != null)
     {
         this._state["style"] = this.BuildString();
     }
     this._style = null;
 }
        /// <devdoc>
        ///    <para>
        ///       Adds a style to the CssStyleCollection.
        ///    </para>
        /// </devdoc>
        public void Add(string key, string value)
        {
            if (String.IsNullOrEmpty(key))
            {
                throw new ArgumentNullException("key");
            }

            if (_table == null)
            {
                ParseString();
            }
            _table[key] = value;

            if (_intTable != null)
            {
                // Remove from the other table to avoid duplicates.
                HtmlTextWriterStyle style = CssTextWriter.GetStyleKey(key);
                if (style != (HtmlTextWriterStyle)(-1))
                {
                    _intTable.Remove(style);
                }
            }

            if (_state != null)
            {
                // keep style attribute synchronized
                _state["style"] = BuildString();
            }
            _style = null;
        }
        /*
         * Automatically adds new keys.
         */

        /// <devdoc>
        ///    <para>
        ///       Gets or sets a specified CSS value.
        ///    </para>
        /// </devdoc>
        public string this[string key] {
            get {
                if (_table == null)
                {
                    ParseString();
                }
                string value = (string)_table[key];

                if (value == null)
                {
                    HtmlTextWriterStyle style = CssTextWriter.GetStyleKey(key);
                    if (style != (HtmlTextWriterStyle)(-1))
                    {
                        value = this[style];
                    }
                }

                return(value);
            }
            set {
                Add(key, value);
            }
        }
 public string this[string key]
 {
     get
     {
         if (this._table == null)
         {
             this.ParseString();
         }
         string str = (string)this._table[key];
         if (str == null)
         {
             HtmlTextWriterStyle styleKey = CssTextWriter.GetStyleKey(key);
             if (styleKey != ~HtmlTextWriterStyle.BackgroundColor)
             {
                 str = this[styleKey];
             }
         }
         return(str);
     }
     set
     {
         this.Add(key, value);
     }
 }