class Array

in global :: System

Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.


public static int BinarySearch( Array array, int index, int length, object value )

Searches a range of elements in a one-dimensional sorted array for a value, using the interface implemented by each element of the array and by the specified value.

  • array The sorted one-dimensional to search.
  • index The starting index of the range to search.
  • length The length of the range to search.
  • value The object to search for.
  • Returns The index of the specified in the specified , if is found; otherwise, a negative number. If is not found and is less than one or more elements in , the negative number returned is the bitwise complement of the index of the first element that is larger than . If is not found and is greater than all elements in , the negative number returned is the bitwise complement of (the index of the last element plus 1). If this method is called with a non-sorted , the return value can be incorrect and a negative number could be returned, even if is present in .

public static int BinarySearch( Array array, int index, int length, object value, IComparer comparer )

Searches a range of elements in a one-dimensional sorted array for a value, using the specified interface.

  • array The sorted one-dimensional to search.
  • index The starting index of the range to search.
  • length The length of the range to search.
  • value The object to search for.
  • comparer The implementation to use when comparing elements. -or- to use the implementation of each element.
  • Returns The index of the specified in the specified , if is found; otherwise, a negative number. If is not found and is less than one or more elements in , the negative number returned is the bitwise complement of the index of the first element that is larger than . If is not found and is greater than all elements in , the negative number returned is the bitwise complement of (the index of the last element plus 1). If this method is called with a non-sorted , the return value can be incorrect and a negative number could be returned, even if is present in .

public static int BinarySearch( Array array, object value )

Searches an entire one-dimensional sorted array for a specific element, using the interface implemented by each element of the array and by the specified object.

  • array The sorted one-dimensional to search.
  • value The object to search for.
  • Returns The index of the specified in the specified , if is found; otherwise, a negative number. If is not found and is less than one or more elements in , the negative number returned is the bitwise complement of the index of the first element that is larger than . If is not found and is greater than all elements in , the negative number returned is the bitwise complement of (the index of the last element plus 1). If this method is called with a non-sorted , the return value can be incorrect and a negative number could be returned, even if is present in .

public static int BinarySearch( Array array, object value, IComparer comparer )

Searches an entire one-dimensional sorted array for a value using the specified interface.

  • array The sorted one-dimensional to search.
  • value The object to search for.
  • comparer The implementation to use when comparing elements. -or- to use the implementation of each element.
  • Returns The index of the specified in the specified , if is found; otherwise, a negative number. If is not found and is less than one or more elements in , the negative number returned is the bitwise complement of the index of the first element that is larger than . If is not found and is greater than all elements in , the negative number returned is the bitwise complement of (the index of the last element plus 1). If this method is called with a non-sorted , the return value can be incorrect and a negative number could be returned, even if is present in .

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

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

  • array The array whose elements need to be cleared.
  • index The starting index of the range of elements to clear.
  • length The number of elements to clear.

public static void ConstrainedCopy( Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length )

Copies a range of elements from an starting at the specified source index and pastes them to another starting at the specified destination index. Guarantees that all changes are undone if the copy does not succeed completely.

  • sourceArray The that contains the data to copy.
  • sourceIndex A 32-bit integer that represents the index in the at which copying begins.
  • destinationArray The that receives the data.
  • destinationIndex A 32-bit integer that represents the index in the at which storing begins.
  • length A 32-bit integer that represents the number of elements to copy.

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

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.

  • sourceArray The that contains the data to copy.
  • destinationArray The that receives the data.
  • length A 32-bit integer that represents the number of elements to copy.

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

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 64-bit integer.

  • sourceArray The that contains the data to copy.
  • destinationArray The that receives the data.
  • length A 64-bit integer that represents the number of elements to copy. The integer must be between zero and , inclusive.

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

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.

  • sourceArray The that contains the data to copy.
  • sourceIndex A 32-bit integer that represents the index in the at which copying begins.
  • destinationArray The that receives the data.
  • destinationIndex A 32-bit integer that represents the index in the at which storing begins.
  • length A 32-bit integer that represents the number of elements to copy.

public static void Copy( Array sourceArray, long sourceIndex, Array destinationArray, long destinationIndex, long length )

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 64-bit integers.

  • sourceArray The that contains the data to copy.
  • sourceIndex A 64-bit integer that represents the index in the at which copying begins.
  • destinationArray The that receives the data.
  • destinationIndex A 64-bit integer that represents the index in the at which storing begins.
  • length A 64-bit integer that represents the number of elements to copy. The integer must be between zero and , inclusive.

public 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 destination array index. The index is specified as a 32-bit integer.

  • array The one-dimensional array that is the destination of the elements copied from the current array.
  • index A 32-bit integer that represents the index in at which copying begins.

public void CopyTo( Array array, long index )

Copies all the elements of the current one-dimensional array to the specified one-dimensional array starting at the specified destination array index. The index is specified as a 64-bit integer.

  • array The one-dimensional array that is the destination of the elements copied from the current array.
  • index A 64-bit integer that represents the index in at which copying begins.

public static Array CreateInstance( Type elementType, int length )

Creates a one-dimensional of the specified and length, with zero-based indexing.

  • elementType The of the to create.
  • length The size of the to create.
  • Returns A new one-dimensional of the specified with the specified length, using zero-based indexing.

public static Array CreateInstance( Type elementType, int length1, int length2 )

Creates a two-dimensional of the specified and dimension lengths, with zero-based indexing.

  • elementType The of the to create.
  • length1 The size of the first dimension of the to create.
  • length2 The size of the second dimension of the to create.
  • Returns A new two-dimensional of the specified with the specified length for each dimension, using zero-based indexing.

public static Array CreateInstance( Type elementType, int length1, int length2, int length3 )

Creates a three-dimensional of the specified and dimension lengths, with zero-based indexing.

  • elementType The of the to create.
  • length1 The size of the first dimension of the to create.
  • length2 The size of the second dimension of the to create.
  • length3 The size of the third dimension of the to create.
  • Returns A new three-dimensional of the specified with the specified length for each dimension, using zero-based indexing.

public static Array CreateInstance( Type elementType, int[] lengths )

Creates a multidimensional of the specified and dimension lengths, with zero-based indexing. The dimension lengths are specified in an array of 32-bit integers.

  • elementType The of the to create.
  • lengths An array of 32-bit integers that represent the size of each dimension of the to create.
  • Returns A new multidimensional of the specified with the specified length for each dimension, using zero-based indexing.

public static Array CreateInstance( Type elementType, int[] lengths, int[] lowerBounds )

Creates a multidimensional of the specified and dimension lengths, with the specified lower bounds.

  • elementType The of the to create.
  • lengths A one-dimensional array that contains the size of each dimension of the to create.
  • lowerBounds A one-dimensional array that contains the lower bound (starting index) of each dimension of the to create.
  • Returns A new multidimensional of the specified with the specified length and lower bound for each dimension.

public static Array CreateInstance( Type elementType, long[] lengths )

Creates a multidimensional of the specified and dimension lengths, with zero-based indexing. The dimension lengths are specified in an array of 64-bit integers.

  • elementType The of the to create.
  • lengths An array of 64-bit integers that represent the size of each dimension of the to create. Each integer in the array must be between zero and , inclusive.
  • Returns A new multidimensional of the specified with the specified length for each dimension, using zero-based indexing.

public int GetLength( int dimension )

Gets a 32-bit integer that represents the number of elements in the specified dimension of the .

  • dimension A zero-based dimension of the whose length needs to be determined.
  • Returns A 32-bit integer that represents the number of elements in the specified dimension.

public long GetLongLength( int dimension )

Gets a 64-bit integer that represents the number of elements in the specified dimension of the .

  • dimension A zero-based dimension of the whose length needs to be determined.
  • Returns A 64-bit integer that represents the number of elements in the specified dimension.

public int GetLowerBound( int dimension )

Gets the index of the first element of the specified dimension in the array.

  • dimension A zero-based dimension of the array whose starting index needs to be determined.
  • Returns The index of the first element of the specified dimension in the array.

public int GetUpperBound( int dimension )

Gets the index of the last element of the specified dimension in the array.

  • dimension A zero-based dimension of the array whose upper bound needs to be determined.
  • Returns The index of the last element of the specified dimension in the array, or -1 if the specified dimension is empty.

public object GetValue( int index )

Gets the value at the specified position in the one-dimensional . The index is specified as a 32-bit integer.

  • index A 32-bit integer that represents the position of the element to get.
  • Returns The value at the specified position in the one-dimensional .

public object GetValue( int index1, int index2 )

Gets the value at the specified position in the two-dimensional . The indexes are specified as 32-bit integers.

  • index1 A 32-bit integer that represents the first-dimension index of the element to get.
  • index2 A 32-bit integer that represents the second-dimension index of the element to get.
  • Returns The value at the specified position in the two-dimensional .

public object GetValue( int index1, int index2, int index3 )

Gets the value at the specified position in the three-dimensional . The indexes are specified as 32-bit integers.

  • index1 A 32-bit integer that represents the first-dimension index of the element to get.
  • index2 A 32-bit integer that represents the second-dimension index of the element to get.
  • index3 A 32-bit integer that represents the third-dimension index of the element to get.
  • Returns The value at the specified position in the three-dimensional .

public object GetValue( int[] indices )

Gets the value at the specified position in the multidimensional . The indexes are specified as an array of 32-bit integers.

  • indices A one-dimensional array of 32-bit integers that represent the indexes specifying the position of the element to get.
  • Returns The value at the specified position in the multidimensional .

public object GetValue( long index )

Gets the value at the specified position in the one-dimensional . The index is specified as a 64-bit integer.

  • index A 64-bit integer that represents the position of the element to get.
  • Returns The value at the specified position in the one-dimensional .

public object GetValue( long index1, long index2 )

Gets the value at the specified position in the two-dimensional . The indexes are specified as 64-bit integers.

  • index1 A 64-bit integer that represents the first-dimension index of the element to get.
  • index2 A 64-bit integer that represents the second-dimension index of the element to get.
  • Returns The value at the specified position in the two-dimensional .

public object GetValue( long index1, long index2, long index3 )

Gets the value at the specified position in the three-dimensional . The indexes are specified as 64-bit integers.

  • index1 A 64-bit integer that represents the first-dimension index of the element to get.
  • index2 A 64-bit integer that represents the second-dimension index of the element to get.
  • index3 A 64-bit integer that represents the third-dimension index of the element to get.
  • Returns The value at the specified position in the three-dimensional .

public object GetValue( long[] indices )

Gets the value at the specified position in the multidimensional . The indexes are specified as an array of 64-bit integers.

  • indices A one-dimensional array of 64-bit integers that represent the indexes specifying the position of the element to get.
  • Returns The value at the specified position in the multidimensional .

public static int IndexOf( Array array, object value )

Searches for the specified object and returns the index of its first occurrence in a one-dimensional array.

  • array The one-dimensional array to search.
  • value The object to locate in .
  • Returns The index of the first occurrence of in , if found; otherwise, the lower bound of the array minus 1.

public static int IndexOf( Array array, object value, int startIndex )

Searches for the specified object in a range of elements of a one-dimensional array, and returns the index of its first occurrence. The range extends from a specified index to the end of the array.

  • array The one-dimensional array to search.
  • value The object to locate in .
  • startIndex The starting index of the search. 0 (zero) is valid in an empty array.
  • Returns The index of the first occurrence of , if it's found, within the range of elements in that extends from to the last element; otherwise, the lower bound of the array minus 1.

public static int IndexOf( Array array, object value, int startIndex, int count )

Searches for the specified object in a range of elements of a one-dimensional array, and returns the index of ifs first occurrence. The range extends from a specified index for a specified number of elements.

  • array The one-dimensional array to search.
  • value The object to locate in .
  • startIndex The starting index of the search. 0 (zero) is valid in an empty array.
  • count The number of elements to search.
  • Returns The index of the first occurrence of , if it's found in the from index to + - 1; otherwise, the lower bound of the array minus 1.

public bool IsFixedSize { get; }

Gets a value indicating whether the has a fixed size.

  • Returns This property is always for all arrays.

public bool IsReadOnly { get; }

Gets a value indicating whether the is read-only.

  • Returns This property is always for all arrays.

public bool IsSynchronized { get; }

Gets a value indicating whether access to the is synchronized (thread safe).

  • Returns This property is always for all arrays.

public static int LastIndexOf( Array array, object value )

Searches for the specified object and returns the index of the last occurrence within the entire one-dimensional .

  • array The one-dimensional to search.
  • value The object to locate in .
  • Returns The index of the last occurrence of within the entire , if found; otherwise, the lower bound of the array minus 1.

public static int LastIndexOf( Array array, object value, int startIndex )

Searches for the specified object and returns the index of the last occurrence within the range of elements in the one-dimensional that extends from the first element to the specified index.

  • array The one-dimensional to search.
  • value The object to locate in .
  • startIndex The starting index of the backward search.
  • Returns The index of the last occurrence of within the range of elements in that extends from the first element to , if found; otherwise, the lower bound of the array minus 1.

public static int LastIndexOf( Array array, object value, int startIndex, int count )

Searches for the specified object and returns the index of the last occurrence within the range of elements in the one-dimensional that contains the specified number of elements and ends at the specified index.

  • array The one-dimensional to search.
  • value The object to locate in .
  • startIndex The starting index of the backward search.
  • count The number of elements in the section to search.
  • Returns The index of the last occurrence of within the range of elements in that contains the number of elements specified in and ends at , if found; otherwise, the lower bound of the array minus 1.

public int Length { get; }

Gets the total number of elements in all the dimensions of the .

  • Returns The total number of elements in all the dimensions of the ; zero if there are no elements in the array.

public long LongLength { get; }

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

  • Returns A 64-bit integer that represents the total number of elements in all the dimensions of the .

public int Rank { get; }

Gets the rank (number of dimensions) of the . For example, a one-dimensional array returns 1, a two-dimensional array returns 2, and so on.

  • Returns The rank (number of dimensions) of the .

public static void Reverse( Array array )

Reverses the sequence of the elements in the entire one-dimensional .

  • array The one-dimensional to reverse.

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

Reverses the sequence of the elements in a range of elements in the one-dimensional .

  • array The one-dimensional to reverse.
  • index The starting index of the section to reverse.
  • length The number of elements in the section to reverse.

public void SetValue( object value, int index )

Sets a value to the element at the specified position in the one-dimensional . The index is specified as a 32-bit integer.

  • value The new value for the specified element.
  • index A 32-bit integer that represents the position of the element to set.

public void SetValue( object value, int index1, int index2 )

Sets a value to the element at the specified position in the two-dimensional . The indexes are specified as 32-bit integers.

  • value The new value for the specified element.
  • index1 A 32-bit integer that represents the first-dimension index of the element to set.
  • index2 A 32-bit integer that represents the second-dimension index of the element to set.

public void SetValue( object value, int index1, int index2, int index3 )

Sets a value to the element at the specified position in the three-dimensional . The indexes are specified as 32-bit integers.

  • value The new value for the specified element.
  • index1 A 32-bit integer that represents the first-dimension index of the element to set.
  • index2 A 32-bit integer that represents the second-dimension index of the element to set.
  • index3 A 32-bit integer that represents the third-dimension index of the element to set.

public void SetValue( object value, int[] indices )

Sets a value to the element at the specified position in the multidimensional . The indexes are specified as an array of 32-bit integers.

  • value The new value for the specified element.
  • indices A one-dimensional array of 32-bit integers that represent the indexes specifying the position of the element to set.

public void SetValue( object value, long index )

Sets a value to the element at the specified position in the one-dimensional . The index is specified as a 64-bit integer.

  • value The new value for the specified element.
  • index A 64-bit integer that represents the position of the element to set.

public void SetValue( object value, long index1, long index2 )

Sets a value to the element at the specified position in the two-dimensional . The indexes are specified as 64-bit integers.

  • value The new value for the specified element.
  • index1 A 64-bit integer that represents the first-dimension index of the element to set.
  • index2 A 64-bit integer that represents the second-dimension index of the element to set.

public void SetValue( object value, long index1, long index2, long index3 )

Sets a value to the element at the specified position in the three-dimensional . The indexes are specified as 64-bit integers.

  • value The new value for the specified element.
  • index1 A 64-bit integer that represents the first-dimension index of the element to set.
  • index2 A 64-bit integer that represents the second-dimension index of the element to set.
  • index3 A 64-bit integer that represents the third-dimension index of the element to set.

public void SetValue( object value, long[] indices )

Sets a value to the element at the specified position in the multidimensional . The indexes are specified as an array of 64-bit integers.

  • value The new value for the specified element.
  • indices A one-dimensional array of 64-bit integers that represent the indexes specifying the position of the element to set.

public static void Sort( Array array )

Sorts the elements in an entire one-dimensional using the implementation of each element of the .

  • array The one-dimensional to sort.

public static void Sort( Array keys, Array items )

Sorts a pair of one-dimensional objects (one contains the keys and the other contains the corresponding items) based on the keys in the first using the implementation of each key.

  • keys The one-dimensional that contains the keys to sort.
  • items The one-dimensional that contains the items that correspond to each of the keys in the . -or- to sort only the .

public static void Sort( Array keys, Array items, IComparer comparer )

Sorts a pair of one-dimensional objects (one contains the keys and the other contains the corresponding items) based on the keys in the first using the specified .

  • keys The one-dimensional that contains the keys to sort.
  • items The one-dimensional that contains the items that correspond to each of the keys in the . -or- to sort only the .
  • comparer The implementation to use when comparing elements. -or- to use the implementation of each element.

public static void Sort( Array keys, Array items, int index, int length )

Sorts a range of elements in a pair of one-dimensional objects (one contains the keys and the other contains the corresponding items) based on the keys in the first using the implementation of each key.

  • keys The one-dimensional that contains the keys to sort.
  • items The one-dimensional that contains the items that correspond to each of the keys in the . -or- to sort only the .
  • index The starting index of the range to sort.
  • length The number of elements in the range to sort.

public static void Sort( Array keys, Array items, int index, int length, IComparer comparer )

Sorts a range of elements in a pair of one-dimensional objects (one contains the keys and the other contains the corresponding items) based on the keys in the first using the specified .

  • keys The one-dimensional that contains the keys to sort.
  • items The one-dimensional that contains the items that correspond to each of the keys in the . -or- to sort only the .
  • index The starting index of the range to sort.
  • length The number of elements in the range to sort.
  • comparer The implementation to use when comparing elements. -or- to use the implementation of each element.

public static void Sort( Array array, IComparer comparer )

Sorts the elements in a one-dimensional using the specified .

  • array The one-dimensional array to sort.
  • comparer The implementation to use when comparing elements. -or- to use the implementation of each element.

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

Sorts the elements in a range of elements in a one-dimensional using the implementation of each element of the .

  • array The one-dimensional to sort.
  • index The starting index of the range to sort.
  • length The number of elements in the range to sort.

public static void Sort( Array array, int index, int length, IComparer comparer )

Sorts the elements in a range of elements in a one-dimensional using the specified .

  • array The one-dimensional to sort.
  • index The starting index of the range to sort.
  • length The number of elements in the range to sort.
  • comparer The implementation to use when comparing elements. -or- to use the implementation of each element.

public object SyncRoot { get; }

Gets an object that can be used to synchronize access to the .

  • Returns An object that can be used to synchronize access to the .

public IEnumerator GetEnumerator( )

😔 No documentation found.

public static int MaxLength { get; }

😔 No documentation found.

public static int LastIndexOf( T[] array, T value, int startIndex )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public static void Reverse( T[] array )

😔 No documentation found.

public static int LastIndexOf( T[] array, T value, int startIndex, int count )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public static void Sort( TKey[] keys, TValue[] items )

😔 No documentation found.

public static void Sort( T[] array, int index, int length )

😔 No documentation found.

public static void Sort( TKey[] keys, TValue[] items, int index, int length )

😔 No documentation found.

public static void Sort( T[] array, IComparer<T> comparer )

😔 No documentation found.

public static void Sort( TKey[] keys, TValue[] items, IComparer<TKey> comparer )

😔 No documentation found.

public static void Sort( T[] array, int index, int length, IComparer<T> comparer )

😔 No documentation found.

public static void Sort( TKey[] keys, TValue[] items, int index, int length, IComparer<TKey> comparer )

😔 No documentation found.

public static void Sort( T[] array, Comparison<T> comparison )

😔 No documentation found.

public static bool TrueForAll( T[] array, Predicate<T> match )

😔 No documentation found.

public static void Reverse( T[] array, int index, int length )

😔 No documentation found.

public static void Sort( T[] array )

😔 No documentation found.

public static void Fill( T[] array, T value, int startIndex, int count )

😔 No documentation found.

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

😔 No documentation found.

public static Array CreateInstanceFromArrayType( Type arrayType, int length )

😔 No documentation found.

public static Array CreateInstanceFromArrayType( Type arrayType, int[] lengths )

😔 No documentation found.

public static Array CreateInstanceFromArrayType( Type arrayType, int[] lengths, int[] lowerBounds )

😔 No documentation found.

public void Initialize( )

😔 No documentation found.

public static void Clear( Array array )

😔 No documentation found.

public static int BinarySearch( T[] array, T value )

😔 No documentation found.

public static int BinarySearch( T[] array, T value, IComparer<T> comparer )

😔 No documentation found.

public static int BinarySearch( T[] array, int index, int length, T value )

😔 No documentation found.

public static int BinarySearch( T[] array, int index, int length, T value, IComparer<T> comparer )

😔 No documentation found.

public static TOutput[] ConvertAll( TInput[] array, Converter<TInput,TOutput> converter )

😔 No documentation found.

public bool Equals( object obj )

😔 No documentation found.

public static T[] Empty( )

😔 No documentation found.

public static bool Exists( T[] array, Predicate<T> match )

😔 No documentation found.

public static void Fill( T[] array, T value )

😔 No documentation found.

public static ReadOnlyCollection<T> AsReadOnly( T[] array )

😔 No documentation found.

public static T Find( T[] array, Predicate<T> match )

😔 No documentation found.

public static T[] FindAll( T[] array, Predicate<T> match )

😔 No documentation found.

public static int FindIndex( T[] array, Predicate<T> match )

😔 No documentation found.

public static int FindIndex( T[] array, int startIndex, Predicate<T> match )

😔 No documentation found.

public static int FindIndex( T[] array, int startIndex, int count, Predicate<T> match )

😔 No documentation found.

public static T FindLast( T[] array, Predicate<T> match )

😔 No documentation found.

public static int FindLastIndex( T[] array, Predicate<T> match )

😔 No documentation found.

public static int FindLastIndex( T[] array, int startIndex, Predicate<T> match )

😔 No documentation found.

public static int FindLastIndex( T[] array, int startIndex, int count, Predicate<T> match )

😔 No documentation found.

public static void ForEach( T[] array, Action<T> action )

😔 No documentation found.

public static int IndexOf( T[] array, T value )

😔 No documentation found.

public static int IndexOf( T[] array, T value, int startIndex )

😔 No documentation found.

public static int LastIndexOf( T[] array, T value )

😔 No documentation found.

public static int IndexOf( T[] array, T value, int startIndex, int count )

😔 No documentation found.