Пример #1
0
        /// <summary>
        /// Insert a value at the specified index.
        /// </summary>
        /// <param name="index">
        /// The zero-based index at which value should be inserted.
        /// </param>
        /// <param name="value">
        /// The Object to insert into the IList.
        /// </param>
        public virtual void Insert(int index, object value)
        {
            if (this.IsReadOnly)
            {
                throw new NotSupportedException();
            }

            if (index == count)
            {
                this.AddBack(value);
            }
            else
            {
                enumerator.MoveTo(index);

                if (enumerator.MoveNext())
                {
                    ListNode insert = (ListNode)enumerator.Current;
                    this.InsertNode(value, insert);
                }
            }
        }