System.Collections.ArrayList

Summary


Provides the class for a weakly typed collection.
Defined in ArrayList.js

Constructors

System.Collections.ArrayList()
Initializes a new instance of the ArrayList class that is empty.

Methods

  • Int Add(<Object> value)
    Adds an object to the end of the ArrayList.

    Parameters

    • value - The object to be added to the end of the ArrayList.

    Return Values

    The ArrayList index at which the value has been added.
  • void AddRange(<Array> value)
    Adds the elements of an array to the end of the ArrayList.

    Parameters

    • value - The array whose elements should be added to the end of the ArrayList.
  • void Clear()
    Removes all elements from the ArrayList.
  • ArrayList Clone()
    Creates a shallow copy of the ArrayList. A shallow copy of a collection copies only the elements of the collection, whether they are reference types or value types, but it does not copy the objects that the references refer to. The references in the new collection point to the same objects that the references in the original collection point to.

    Return Values

    A shallow copy of the ArrayList.
  • Boolean Contains(object)
    Determines whether an element is in the ArrayList.

    Parameters

    • item - The object to locate in the ArrayList.

    Return Values

    True if item is found in the ArrayList; otherwise, false.
  • void CopyTo(<Array> array)
    Copies the entire ArrayList to a compatible one-dimensional Array, starting at the beginning of the target array.

    Parameters

    • array - The one-dimensional Array that is the destination of the elements copied from ArrayList.
  • Int GetCount()
    Gets the number of elements actually contained in the ArrayList.

    Return Values

    The number of elements actually contained in the ArrayList.
  • Object GetItem(<Int> index)
    Gets the element at the specified index.

    Parameters

    • index - The zero-based index of the element to get.

    Return Values

    The element at the specified index.
  • ArrayList GetRange(<Int> index, <Int> count)
    Returns an ArrayList which represents a subset of the elements in the source ArrayList.

    Parameters

    • index - The zero-based ArrayList index at which the range starts.
    • count - The number of elements in the range.

    Return Values

    An ArrayList which represents a subset of the elements in the source ArrayList.
  • Int IndexOf(<Object> value)
    Searches for the specified object and returns the zero-based index of the first occurrence within the entire ArrayList.

    Parameters

    • value - The object to locate in the ArrayList.

    Return Values

    The zero-based index of the first occurrence of value within the entire ArrayList, if found; otherwise, -1.
  • void Insert(<Int> index, <Object> value)
    Inserts an element into the ArrayList at the specified index.

    Parameters

    • index - The zero-based index at which value should be inserted.
    • value - The object to insert.
  • void InsertRange(<Int> index, <Array> value)
    Inserts the elements of a collection into the ArrayList at the specified index.

    Parameters

    • index - The zero-based index at which the new elements should be inserted.
    • value - The array whose elements should be inserted into the ArrayList.
  • Int LastIndexOf(<Object> value)
    Searches for the specified object and returns the zero-based index of the last occurrence within the entire ArrayList.

    Parameters

    • value - The object to locate in the ArrayList.

    Return Values

    The zero-based index of the last occurrence of value within the entire the ArrayList, if found; otherwise, -1.
  • void Remove(<Object> obj)
    Removes the first occurrence of a specific object from the ArrayList.

    Parameters

    • obj - The object to remove from the ArrayList.
  • void RemoveAt(<Int> index)
    Removes the element at the specified index of the ArrayList.

    Parameters

    • index - The zero-based index of the element to remove.
  • void RemoveRange(<Int> index, <Int> count)
    Removes a range of elements from the ArrayList.

    Parameters

    • index - The zero-based starting index of the range of elements to remove.
    • count - The number of elements to remove.
  • void Reverse()
    Reverses the order of the elements in the ArrayList.
  • void SetItem(<Int> index, <Object> value)
    Sets the element at the specified index.

    Parameters

    • index - The zero-based index of the element to set.
    • value - The object to be set at the specified index.
  • void SetRange(<Int> index, <Array> value)
    Copies the elements of an array over a range of elements in the ArrayList.

    Parameters

    • index - The zero-based ArrayList index at which to start copying the elements of value.
    • value - The array whose elements to copy to the ArrayList.
  • void Sort(<Function> comparer)
    Sorts the elements in the entire ArrayList (optionally using the specified comparer function).

    Parameters

    • comparer - Optional. Specifies the sort order. Must be a function.
  • Array ToArray()
    Copies the elements of the ArrayList to a new array.

    Return Values

    An array containing copies of the elements of the ArrayList.
  • String ToString(<String> seperator)
    Returns a string that represents the current ArrayList.

    Parameters

    • seperator - Optional. Specifies the separator to be used.

    Return Values

    A comma-delimited string. Equivilent to ArrayList.ToArray().join().