System.Array
Represents an array, which is a zero-based, one-dimensional array of objects or of value types. The Array class is the base class for all array types in the .NET Framework.
Arrays are objects; their type is different from the type of the elements they contain. This allows uniform treatment of arrays and their elements by methods in the Array class. Arrays have a fixed size, which is determined when the array is created.
Properties
-
IsFixedSize
bool IsFixedSize { get; }
Gets a value indicating whether the Array has a fixed size.
-
IsReadOnly
bool IsReadOnly { get; }
Gets a value indicating whether the Array is read-only.
-
IsSynchronized
bool IsSynchronized { get; }
Gets a value indicating whether access to the Array is synchronized (thread-safe).
-
Length
int Length { get; }
Gets the total number of elements in all dimensions in the Array.
-
Rank
int Rank { get; }
Gets the number of dimensions of the Array.
-
SyncRoot
object SyncRoot { get; }
Gets an object that can be used to synchronize access to the Array.
Methods
-
Array()
protected Array();
Initializes a new instance of the Array class.
-
Clear(Array array, int index, int length)
static void Clear(Array array, int index, int length);
Removes all elements from the specified section of the array and sets them to their default value.
-
Clone()
object Clone();
Creates a shallow copy of the current array.
-
Copy(Array sourceArray, Array destinationArray, int length)
static void Copy(Array sourceArray, Array destinationArray, int length);
Copies a range of elements from an Array, starting at the beginning of the specified array and ending at the specified number of elements, to another Array, starting at the beginning of the specified array and ending at the specified number of elements.
-
CopyTo(Array array, int index)
void CopyTo(Array array, int index);
Copies all the elements of the current one-dimensional Array to the specified one-dimensional Array, starting at the specified index of the target array.
-
GetEnumerator()
virtual IEnumerator GetEnumerator();
Returns an enumerator that iterates through the Array.
-
GetValue(int index)
virtual object GetValue(int index);
Gets the value of the element at the specified index in the one-dimensional array.
-
IndexOf(Array array, object value)
static int IndexOf(Array array, object value);
Searches for the specified element and returns the zero-based index of its first occurrence within the entire one-dimensional array.
-
Initialize()
void Initialize();
Initializes each element of the array. This method is not intended to be called directly and is used internally by the .NET Framework.
-
Reverse(Array array)
static void Reverse(Array array);
Reverses the order of the elements in the entire one-dimensional array.
-
SetValue(object value, int index)
virtual void SetValue(object value, int index);
Assigns a value to the element at the specified index in the one-dimensional array.
-
Sort(Array array)
static void Sort(Array array);
Sorts the elements in the entire one-dimensional Array.
-
static string ToString(Array array);
Converts the elements in an array to their string representation and returns a comma-separated string.
Fields
-
static readonly Array Empty;
Represents an empty array that has no elements and can be used for operations that require an empty array.