Array Class

Namespace: System
Assembly: mscorlib

Summary

Represents a one-dimensional, zero-based array of objects or of value types.

The Array class is the base class for all array types in the .NET Framework. Arrays are zero-based; the first element is at index 0 and the last element is at index Length - 1.

Constructors

  • Array()

    public Array()

    Initializes a new instance of the Array class.

Methods

  • Clear(Array array, int index, int length)

    public static void Clear(Array array, int index, int length)

    Sets a range of elements in the array to the default value of each element.

  • Copy(Array sourceArray, Array destinationArray, int length)

    public static void Copy(Array sourceArray, Array destinationArray, int length)

    Copies a range of array elements to another array.

  • IndexOf(Array array, object value)

    public static int IndexOf(Array array, object value)

    Searches for the specified object and returns the zero-based index of the first occurrence within the entire array.

  • Reverse(Array array)

    public static void Reverse(Array array)

    Reverses the order of the elements in the entire one-dimensional array.

  • Sort(Array array)

    public static void Sort(Array array)

    Sorts the elements in the entire one-dimensional array.

  • Resize<T>(ref T[] array, int newSize)

    public static void Resize<T>(ref T[] array, int newSize)

    Resizes the specified array to the specified value.

Properties

  • Length

    public int Length { get; }

    Gets a 32-bit integer that represents the total number of elements in all the dimensions in the Array.

  • IsReadOnly

    public bool IsReadOnly { get; }

    Gets a value indicating whether the Array has a fixed size.

Fields

  • LongLength

    public long LongLength { get; }

    Gets a 64-bit integer that represents the total number of elements in all the dimensions in the Array.