Compartir a través de


ArrayList.Insert Method

Inserts a specified object into the ArrayList collection at a specified index number.

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)

Syntax

public virtual void Insert (
         intindex,
         Objectvalue
)

Parameters

  • index
    The zero-based index number where you want the object to be inserted.
  • value
    The object you want to insert. This value can be a null reference.

Remarks

The ArrayList collection accepts a null reference as a valid value and allows duplicate objects.

If the value of the Count property already equals the value of the Capacity property, Insert automatically doubles the capacity of the list before the object is inserted.

If the index parameter is equal to the value of the Count property, the contents of the value parameter are added to the end of the ArrayList collection.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.

See Also

Reference

ArrayList Class
ArrayList Members
System.Collections Namespace