ItemRemoved() public method

Notifies the client that an item has been removed from this PubSubNode.
public ItemRemoved ( PubSubItem item ) : void
item PubSubItem Item that was removed.
return void
コード例 #1
0
        /// <summary>
        /// Makes sure that the underlying ID index is in sync
        /// when an item is removed.
        /// </summary>
        /// <param name="index">Index of PubSubItem to remove.</param>
        public override void RemoveAt(int index)
        {
            PubSubItem item = (PubSubItem)this[index];
            string     id   = item.GetAttribute("id");

            if (id != "")
            {
                m_index.Remove(id);
            }
            base.RemoveAt(index);
            m_node.ItemRemoved(item);

            // renumber
            for (int i = index; i < Count; i++)
            {
                item = (PubSubItem)this[i];
                id   = item.ID;
                if (id != "")
                {
                    m_index[id] = i;
                }
            }
        }