示例#1
0
        /// <summary>
        /// Inserts an item into the collection at the specified index.
        /// </summary>
        /// <param name="index">The zero-based index at which the item should be inserted</param>
        /// <param name="item">The object to insert</param>
        protected override void InsertItem(int index, IndexedElement <T> item)
        {
            base.InsertItem(index, item);

            for (int i = index; i < Count; i++)
            {
                this[i].Index = i;
            }
        }
示例#2
0
 /// <summary>
 /// Replaces the element at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index of the element to replace.</param>
 /// <param name="item">The new value for the element at the specified index.</param>
 protected override void SetItem(int index, IndexedElement <T> item)
 {
     item.Index = index;
     base.SetItem(index, item);
 }