[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.
Assembly: mscorlib (in mscorlib.dll)
Thetype exposes the following members.
|IsFixedSize||Gets a value indicating whether the has a fixed size.|
|IsReadOnly||Gets a value indicating whether the is read-only.|
|IsSynchronized||Gets a value indicating whether access to the is synchronized (thread safe).|
|Length||Gets a 32-bit integer that represents the total number of elements in all the dimensions of the .|
|SyncRoot||Gets an object that can be used to synchronize access to the .|
|BinarySearch(Array, Object, IComparer)||Searches an entire one-dimensional sorted for a value using the specified IComparer interface.|
|BinarySearch(Array, Int32, Int32, Object, IComparer)||Searches a range of elements in a one-dimensional sorted for a value, using the specified IComparer interface.|
|Clear||Sets a range of elements in the to zero, to false, or to nullNothingnullptrunita null reference (Nothing in Visual Basic), depending on the element type.|
|Clone||Creates a shallow copy of the .|
|Copy(Array, Array, Int32)||Copies a range of elements from an starting at the first element and pastes them into another starting at the first element. The length is specified as a 32-bit integer.|
|Copy(Array, Int32, Array, Int32, Int32)||Copies a range of elements from an starting at the specified source index and pastes them to another starting at the specified destination index. The length and the indexes are specified as 32-bit integers.|
|CopyTo||Copies all the elements of the current one-dimensional to the specified one-dimensional starting at the specified destination index. The index is specified as a 32-bit integer.|
|CreateInstance||Creates a one-dimensional of the specified Type and length, with zero-based indexing.|
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|GetEnumerator||Returns an IEnumerator for the .|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|GetValue||Gets the value at the specified position in the one-dimensional . The index is specified as a 32-bit integer.|
|IndexOf(Array, Object)||Searches for the specified object and returns the index of the first occurrence within the entire one-dimensional .|
|IndexOf(Array, Object, Int32)||Searches for the specified object and returns the index of the first occurrence within the range of elements in the one-dimensional that extends from the specified index to the last element.|
|IndexOf(Array, Object, Int32, Int32)||Searches for the specified object and returns the index of the first occurrence within the range of elements in the one-dimensional that starts at the specified index and contains the specified number of elements.|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
|ICollection..::..Count||Gets the number of elements contained in the .|
|IList..::..Add||Adds an item to IList.|
|IList..::..Clear||Removes all items from the IList.|
|IList..::..Contains||Determines whether an element is in the IList.|
|IList..::..IndexOf||Determines the index of a specific item in the IList.|
|IList..::..Insert||Inserts an item to the IList at the specified index.|
|IList..::..Item||Gets or sets the element at the specified index.|
|IList..::..Remove||Removes the first occurrence of a specific object from the IList.|
|IList..::..RemoveAt||Removes the IList item at the specified index.|
The class is the base class for language implementations that support arrays. However, only the system and compilers can derive explicitly from the class. Users should employ the array constructs provided by the language.
An element is a value in an . The length of an is the total number of elements it can contain. The rank of an is the number of dimensions in the . The lower bound of a dimension of an is the starting index of that dimension of the ; a multidimensional can have different bounds for each dimension. An array can have a maximum of 32 dimensions.
Type..::..IsArray and Type..::..GetElementType might not return the expected results with because if an array is cast to the type , the result is an object, not an array. That is, typeof(System.Array).IsArray returns false, and typeof(System.Array).GetElementType returns nullNothingnullptrunita null reference (Nothing in Visual Basic).
Unlike most classes, provides the method, instead of public constructors, to allow for late bound access.
The Array..::..Copy method copies elements not only between arrays of the same type but also between standard arrays of different types; it handles type casting automatically.
Some methods, such as CreateInstance, Copy, CopyTo, , and , provide overloads that accept 64-bit integers as parameters to accommodate large capacity arrays. and return 64-bit integers indicating the length of the array.
The is not guaranteed to be sorted. You must sort the prior to performing operations (such as BinarySearch) that require the to be sorted.
Public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
This implementation does not provide a synchronized (thread safe) wrapper for an ; however, .NET Framework classes based on provide their own synchronized version of the collection using the SyncRoot property.
Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.