Inserts a single element, or a collection of elements, at the specified position in the List<T>. To insert at the end of the list, specify the current size of the list plus one.

The element and all subsequent elements in the list are moved down to accommodate the added element(s). (This movement includes any unknown value entries).

Return type: VOID

Access: PUBLIC

Applies to: Progress.Collections.List<T> class

Syntax

Insert(index AS INTEGER, element AS T)

Insert(index AS INTEGER, otherCollection AS ICollection<T>)
index
The one-based index at which the element, or collection of elements, should be inserted. An error is raised if index is less than 1 or index is greater than the size of the list plus one.
element
The object to insert into the List<T>.
otherCollection
The collection that contains the elements to be inserted into the List<T>.

Notes

  • Any iterators on the list become invalid once Add(), AddAll(), Clear(), Insert(), Remove(), RemoveAt(), or Set() are called, and you must get a new iterator to iterate over the list.
  • When an object-oriented ABL object is added to a collection, the reference count of the object is incremented so that it is not garbage collected while it remains in the collection.
  • For both List<T> and SortedSet<T>, Insert() raises an error if otherCollection represents the same collection instance.

See also

<T> Generic type reference