/// <summary> /// Adds to the end of the list, replacing any item with the same ID, /// or bumping the oldest item if the list is full. /// </summary> /// <param name="value">PubSubItem to add to the list.</param> /// <returns>Index where the PubSubItem was inserted.</returns> public override int Add(object value) { PubSubItem item = value as PubSubItem; if (item == null) { throw new ArgumentException("Must be an XmlElement", "value"); } string id = item.ID; int i; if (id == null) { if (Count == Capacity) { RemoveAt(0); } i = base.Add(value); m_node.ItemAdded(item); return(i); } // RemoveId(id); if (!m_index.Contains(id) && (Count == Capacity)) { RemoveAt(0); } i = base.Add(value); m_index[id] = i; m_node.ItemAdded(item); return(i); }