Пример #1
0
        /// <summary>
        /// Removes the element at the specified index.
        /// </summary>
        public void RemoveObjectAt(int index)
        {
            ((IList)this).RemoveAt(index);
            // Call ResetCachedValues for all objects moved by the RemoveAt operation.
            int count = ((IList)this).Count;

            for (int idx = index; idx < count; ++idx)
            {
                DocumentObject obj = (DocumentObject)((IList)this)[idx];
                obj.ResetCachedValues();
            }
        }
Пример #2
0
        /// <summary>
        /// Inserts an object at the specified index.
        /// </summary>
        public virtual void InsertObject(int index, DocumentObject val)
        {
            SetParent(val);
            ((IList)this).Insert(index, val);
            // Call ResetCachedValues for all objects moved by the Insert operation.
            int count = ((IList)this).Count;

            for (int idx = index + 1; idx < count; ++idx)
            {
                DocumentObject obj = (DocumentObject)((IList)this)[idx];
                obj.ResetCachedValues();
            }
        }