BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Object System.Collections.IList System.Collections.IStructuralComparable System.Collections.IStructuralEquatable System.ICloneable System.Runtime.InteropServices.ComVisible(true)

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.

By default, the maximum size of an is 2 gigabytes (GB). In a 64-bit environment, you can avoid the size restriction by setting the enabled attribute of the gcAllowVeryLargeObjects configuration element to true in the run-time environment. However, the array will still be limited to a total of 4 billion elements, and to a maximum index of 0X7FEFFFFF in any given dimension (0X7FFFFFC7 for byte arrays and arrays of single-byte structures).

Starting with the .NET Framework 2.0, the class implements the , , and generic interfaces. The implementations are provided to arrays at run time, and therefore are not visible to the documentation build tools. As a result, the generic interfaces do not appear in the declaration syntax for the class, and there are no reference topics for interface members that are accessible only by casting an array to the generic interface type (explicit interface implementations). The key thing to be aware of when you cast an array to one of these interfaces is that members which add, insert, or remove elements throw .

objects provide information about array type declarations. objects with the same array type share the same object.

and 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 null.

Unlike most classes, provides the method, instead of public constructors, to allow for late bound access.

The 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 , , , , 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 ) that require the to be sorted.

Using an object of pointers in native code is not supported and will throw a for several methods.

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

- Method
  2.0.0.0
  4.0.0.0
  System.Collections.ObjectModel.ReadOnlyCollection<T> `` To be added. The array to wrap in a read-only wrapper.

  Returns a read-only wrapper around the specified array.

  A read-only wrapper around the specified array.

  To prevent any modifications to the array, expose the array only through this wrapper.

  The returned has the same enumeration order as the array it wraps.

  A collection that is read-only is simply a collection with a wrapper that prevents modifying the underlying array; therefore, if changes are made to the underlying array, the read-only collection reflects those changes.

  is .
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` ``

  Both and at least one element of do not implement the interface.

  -or-

  is not assignment-compatible with at least one element of .

  -or-

  .UpperBound == .

  is .

  has more than one dimension.

  Both and at least one element of do not implement the interface.

  This method does not support searching arrays that contain negative indexes. must be sorted before calling this method.

  If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operator (~ in C#, Not in Visual Basic) to the negative result to produce an index. If this index is one greater than the upper bound of the array, there are no elements larger than in the array. Otherwise, it is the index of the first element that is larger than .

  Either or every element of must implement the interface, which is used for comparisons. The elements of must already be sorted in increasing value according to the sort order defined by the implementation; otherwise, the result might be incorrect.

  If does not implement the interface, the elements of are not tested for before the search begins. An exception is thrown if the search encounters an element that does not implement .

  Duplicate elements are allowed. If the contains more than one element equal to , the method returns the index of only one of the occurrences, and not necessarily the first one.

  null can always be compared with any other reference type; therefore, comparisons with null do not generate an exception.

  For every element tested, is passed to the appropriate implementation, even if is null. That is, the implementation determines how a given element compares to null.

  This method is an O(log ) operation, where is the of .

  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.

  The index of the specified in the specified , if is found. If is not found and is less than one or more elements in , a negative number which is the bitwise complement of the index of the first element that is larger than . If is not found and is greater than any of the elements in , a negative number which is the bitwise complement of (the index of the last element plus 1).

  The sorted one-dimensional to search. The object to search for. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` ``

  is , and both and at least one element of do not implement the interface.

  -or-

  is , and is not assignment-compatible with at least one element of .

  -or-

  .UpperBound == .

  is . has more than one dimension.

  is , and both and at least one element of do not implement the interface.

  This method does not support searching arrays that contain negative indexes. must be sorted before calling this method.

  If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operator (~ in C#, Not in Visual Basic) to the negative result to produce an index. If this index is one greater than the upper bound of the array, there are no elements larger than in the array. Otherwise, it is the index of the first element that is larger than .

  The comparer customizes how the elements are compared. For example, you can use a as the comparer to perform case-insensitive string searches.

  If is not null, the elements of are compared to the specified value using the specified implementation. The elements of must already be sorted in increasing value according to the sort order defined by ; otherwise, the result might be incorrect.

  If is null, the comparison is done using the implementation provided by the element itself or by the specified value. The elements of must already be sorted in increasing value according to the sort order defined by the implementation; otherwise, the result might be incorrect.

  If is null and does not implement the interface, the elements of are not tested for before the search begins. An exception is thrown if the search encounters an element that does not implement .

  Duplicate elements are allowed. If the contains more than one element equal to , the method returns the index of only one of the occurrences, and not necessarily the first one.

  null can always be compared with any other reference type; therefore, comparisons with null do not generate an exception.

  For every element tested, is passed to the appropriate implementation, even if is null. That is, the implementation determines how a given element compares to null.

  This method is an O(log ) operation, where is the of .

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

  The index of the specified in the specified , if is found. If is not found and is less than one or more elements in , a negative number which is the bitwise complement of the index of the first element that is larger than . If is not found and is greater than any of the elements in , a negative number which is the bitwise complement of (the index of the last element plus 1).

  The sorted one-dimensional to search. The object to search for. The implementation to use when comparing elements. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` `` `` is . has more than one dimension.

  < .GetLowerBound(0).

  -or-

  < 0.

  and do not specify a valid range in (i.e. + > .GetLowerBound(0) + .Length).

  -or-

  .UpperBound == .

  Either or at least one element of does not implement the interface.

  This method does not support searching arrays that contain negative indexes. must be sorted before calling this method.

  If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operator (~ in C#, Not in Visual Basic) to the negative result to produce an index. If this index is one greater than the upper bound of the array, there are no elements larger than in the array. Otherwise, it is the index of the first element that is larger than .

  Either or every element of must implement the interface, which is used for comparisons. The elements of must already be sorted in increasing value according to the sort order defined by the implementation; otherwise, the result might be incorrect.

  If does not implement the interface, the elements of are not tested for before the search begins. An exception is thrown if the search encounters an element that does not implement .

  Duplicate elements are allowed. If the contains more than one element equal to , the method returns the index of only one of the occurrences, and not necessarily the first one.

  null can always be compared with any other reference type; therefore, comparisons with null do not generate an exception.

  For every element tested, is passed to the appropriate implementation, even if is null. That is, the implementation determines how a given element compares to null.

  This method is an O(log ) operation, where is .

  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.

  The index of the specified in the specified , if is found. If is not found and is less than one or more elements in , a negative number which is the bitwise complement of the index of the first element that is larger than . If is not found and is greater than any of the elements in , a negative number which is the bitwise complement of (the index of the last element plus 1).

  The sorted one-dimensional to search. The starting index of the range to search. The length of the range to search. The object to search for. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` `` `` `` is . has more than one dimension.

  is less than .

  -or-

  is less than zero.

  + is greater than + .

  -or-

  .UpperBound == .

  This example demonstrates the method.

  `using System; class BinarySearchExample { public static void Main() { int[] intAry = { 0, 2, 4, 6, 8 }; Console.WriteLine( "The indices and elements of the array are: "); for ( int i = 0; i < intAry.Length; i++ ) Console.Write("[{0}]: {1, -5}", i, intAry[i]); Console.WriteLine(); SearchFor( intAry, 3 ); SearchFor( intAry, 6 ); SearchFor( intAry, 9 ); } public static void SearchFor( Array ar, Object value ) { int i = Array.BinarySearch( ar, 0, ar.Length, value, null ); Console.WriteLine(); if ( i > 0 ) { Console.Write( "The object searched for, {0}, was found ", value ); Console.WriteLine( "at index {1}.", value, i ); } else if ( ~i == ar.Length ) { Console.Write( "The object searched for, {0}, was ", value ); Console.Write( "not found,\nand no object in the array had " ); Console.WriteLine( "greater value. " ); } else { Console.Write( "The object searched for, {0}, was ", value ); Console.Write( "not found.\nThe next larger object is at " ); Console.WriteLine( "index {0}.", ~i ); } } }`

  The output is

  The indices and elements of the array are:

  [0]:0 [1]:2 [2]:4 [3]:6 [4]:8

  The object searched for, 3, was not found.

  The next larger object is at index 2.

  The object searched for, 6, was found at index 3.

  The object searched for, 9, was not found,

  and no object in the array had greater value.

  is , and both and at least one element of do not implement the interface.

  This method does not support searching arrays that contain negative indexes. must be sorted before calling this method.

  If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operator (~ in C#, Not in Visual Basic) to the negative result to produce an index. If this index is one greater than the upper bound of the array, there are no elements larger than in the array. Otherwise, it is the index of the first element that is larger than .

  The comparer customizes how the elements are compared. For example, you can use a as the comparer to perform case-insensitive string searches.

  If is not null, the elements of are compared to the specified value using the specified implementation. The elements of must already be sorted in increasing value according to the sort order defined by ; otherwise, the result might be incorrect.

  If is null, the comparison is done using the implementation provided by the element itself or by the specified value. The elements of must already be sorted in increasing value according to the sort order defined by the implementation; otherwise, the result might be incorrect.

  If is null and does not implement the interface, the elements of are not tested for before the search begins. An exception is thrown if the search encounters an element that does not implement .

  Duplicate elements are allowed. If the contains more than one element equal to , the method returns the index of only one of the occurrences, and not necessarily the first one.

  null can always be compared with any other reference type; therefore, comparisons with null do not generate an exception when using .

  For every element tested, is passed to the appropriate implementation, even if is null. That is, the implementation determines how a given element compares to null.

  This method is an O(log ) operation, where is .

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

  The index of the specified in the specified , if is found. If is not found and is less than one or more elements in , a negative number which is the bitwise complement of the index of the first element that is larger than . If is not found and is greater than any of the elements in , a negative number which is the bitwise complement of (the index of the last element plus 1).

  The sorted one-dimensional to search. The starting index of the range to search. The length of the range to search. The object to search for. The implementation to use when comparing elements. 0
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` To be added. The one-dimensional array to search. The object for which to search.

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

  One of the following values based on the result of the search operation:

  Return Value
  Description
  A non-negative index of in the array.
  was found.
  A negative value, which is the bitwise complement of the index of the first element that is larger than .
  was not found and the value of at least one element of array was greater than .
  A negative value, which is the bitwise complement of one more than the index of the final element.
  was not found, and was greater than the value of all array elements.

  Either or every element of must implement the or interface, which is used for comparisons. The elements of must already be sorted in increasing value according to the sort order defined by the or implementation; otherwise, the behavior is unspecified

  Duplicate elements are allowed. If the array contains more than one element equal to , the method returns the index of only one of the occurrences, but not necessarily the first one.

  can always be compared with any other reference type; therefore, comparisons with do not generate an exception.

  is .

  Neither nor the elements of the array implement the or interfaces.

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` `` is .

  is , and neither nor the elements of the array implement the or interface.

  This method does not support searching arrays that contain negative indexes. must be sorted before calling this method.

  If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operator (~ in C#, Not in Visual Basic) to the negative result to produce an index. If this index is equal to the size of the array, there are no elements larger than in the array. Otherwise, it is the index of the first element that is larger than .

  The comparer customizes how the elements are compared. For example, you can use a as the comparer to perform case-insensitive string searches.

  If is not null, the elements of are compared to the specified value using the specified generic interface implementation. The elements of must already be sorted in increasing value according to the sort order defined by ; otherwise, the result might be incorrect.

  If is null, the comparison is done using the generic interface implementation provided by . The elements of must already be sorted in increasing value according to the sort order defined by the implementation; otherwise, the result might be incorrect.

  If is null and does not implement the generic interface, the elements of are not tested for before the search begins. An exception is thrown if the search encounters an element that does not implement .

  Duplicate elements are allowed. If the contains more than one element equal to , the method returns the index of only one of the occurrences, and not necessarily the first one.

  null can always be compared with any other reference type; therefore, comparisons with null do not generate an exception.

  For every element tested, is passed to the appropriate implementation, even if is null. That is, the implementation determines how a given element compares to null.

  This method is an O(log ) operation, where is the of .

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

  The index of the specified in the specified , if is found. If is not found and is less than one or more elements in , a negative number which is the bitwise complement of the index of the first element that is larger than . If is not found and is greater than any of the elements in , a negative number which is the bitwise complement of (the index of the last element plus 1).

  The sorted one-dimensional, zero-based to search. The object to search for. The implementation to use when comparing elements. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` `` `` To be added. The one-dimensional array to search. To be added. The length of the range to search. The object for which to search.

  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.

  One of the following values based on the result of the search operation:

  Return Value
  Description
  A non-negative index of in the array.
  was found.
  A negative value, which is the bitwise complement of the index of the first element that is larger than .
  was not found and the value of at least one element of array was greater than .
  A negative value, which is the bitwise complement of one more than the index of the final element.
  was not found, and was greater than the value of all array elements.

  Either or every element of must implement the interface, which is used for comparisons. The elements of must already be sorted in increasing value according to the sort order defined by the or implementation; otherwise, the behavior is unspecified

  Duplicate elements are allowed. If the array contains more than one element equal to , the method returns the index of only one of the occurrences, but not necessarily the first one.

  can always be compared with any other reference type; therefore, comparisons with do not generate an exception.

  + is greater than .

  is .

  is less than zero

  -or-

  is less than zero.

  Neither nor the elements of the array implement the or interface.

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` `` `` ``

  and do not specify a valid range in array.

  is .

  is less than zero

  -or-

  is less than zero.

  is , and neither nor the elements of the array implement the or interface.

  This method does not support searching arrays that contain negative indexes. must be sorted before calling this method.

  If the array does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operator (~ in C#, Not in Visual Basic) to the negative result to produce an index. If this index is equal to the size of the array, there are no elements larger than in the array. Otherwise, it is the index of the first element that is larger than .

  The comparer customizes how the elements are compared. For example, you can use a as the comparer to perform case-insensitive string searches.

  If is not null, the elements of are compared to the specified value using the specified generic interface implementation. The elements of must already be sorted in increasing value according to the sort order defined by ; otherwise, the result might be incorrect.

  If is null, the comparison is done using the generic interface implementation provided for type . The elements of must already be sorted in increasing value according to the sort order defined by the implementation; otherwise, the result might be incorrect.

  Duplicate elements are allowed. If the contains more than one element equal to , the method returns the index of only one of the occurrences, and not necessarily the first one.

  null can always be compared with any other reference type; therefore, comparisons with null do not generate an exception when using .

  For every element tested, is passed to the appropriate implementation, even if is null. That is, the implementation determines how a given element compares to null.

  This method is an O(log ) operation, where is .

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

  The index of the specified in the specified , if is found. If is not found and is less than one or more elements in , a negative number which is the bitwise complement of the index of the first element that is larger than . If is not found and is greater than any of the elements in , a negative number which is the bitwise complement of (the index of the last element plus 1).

  The sorted one-dimensional, zero-based to search. The starting index of the range to search. The length of the range to search. The object to search for. The implementation to use when comparing elements. The type of the elements of the array.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
  System.Void `` `` `` is .

  < .GetLowerBound(0).

  < 0.

  and do not specify a valid range in (i.e. + > .GetLowerBound(0) + .Length ).

  This method resets each element in an array to the element type's default value. It sets elements of reference types (including elements) to null, and sets elements of value types to the default values shown in the following table.

  Type

  Value

  false

  All integral and floating point numeric types

  0 (zero)

  Other value types

  Default value of the type's fields

  The range of cleared elements wrap from row to row in a multi-dimensional array.

  This method only clears the values of the elements; it does not delete the elements themselves. An array has a fixed size; therefore, elements cannot be added or removed.

  This method is an O() operation, where is .

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

  The array whose elements need to be cleared. The starting index of the range of elements to clear. The number of elements to clear. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object

  This example demonstrates the method.

  `using System; public class ArrayCloneExample { public static void Main() { int[] intAryOrig = { 3, 4, 5 }; //must explicitly convert clones object into an array int[] intAryClone = (int[]) intAryOrig.Clone(); Console.Write( "The elements of the first array are: " ); foreach( int i in intAryOrig ) Console.Write( "{0,3}", i ); Console.WriteLine(); Console.Write( "The elements of the cloned array are: " ); foreach( int i in intAryClone ) Console.Write( "{0,3}", i ); Console.WriteLine(); //Clear the values of the original array. Array.Clear( intAryOrig, 0, 3 ); Console.WriteLine( "After clearing the first array," ); Console.Write( "The elements of the first array are: " ); foreach( int i in intAryOrig ) Console.Write( "{0,3}", i ); Console.WriteLine(); Console.Write( "The elements of the cloned array are: " ); foreach( int i in intAryClone ) Console.Write( "{0,3}", i ); } }`

  The output is

  The elements of the first array are: 3 4 5

  The elements of the cloned array are: 3 4 5

  After clearing the first array,

  The elements of the first array are: 0 0 0

  The elements of the cloned array are: 3 4 5

  A shallow copy of an copies only the elements of the , 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 point to the same objects that the references in the original point to.

  In contrast, a deep copy of an copies the elements and everything directly or indirectly referenced by the elements.

  The clone is of the same as the original .

  This method is an O() operation, where is .

  Creates a shallow copy of the .

  A shallow copy of the .

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
  System.Void `` `` `` `` ``

  The and parameters must have the same number of dimensions. The type must be the same as or derived from the type; otherwise, an is thrown. Unlike , verifies the compatibility of the array types before performing any operation.

  When copying between multidimensional arrays, the array behaves like a long one-dimensional array, where the rows (or columns) are conceptually laid end-to-end. For example, if an array has three rows (or columns) with four elements each, copying six elements from the beginning of the array would copy all four elements of the first row (or column) and the first two elements of the second row (or column). To start copying from the second element of the third row (or column), must be the upper bound of the first row (or column) plus the length of the second row (or column) plus two.

  If and overlap, this method behaves as if the original values of were preserved in a temporary location before is overwritten.

  [C++]

  This method is equivalent to the standard C/C++ function memmove, not memcpy.

  The arrays can be reference-type arrays or value-type arrays. If and are both reference-type arrays or are both arrays of type , a shallow copy is performed. A shallow copy of an is a new containing references to the same elements as the original . The elements themselves or anything referenced by the elements are not copied. In contrast, a deep copy of an copies the elements and everything directly or indirectly referenced by the elements.

  If this method throws an exception while copying, the remains unchanged; therefore, can be used within a constrained execution region ().

  This method is an O() operation, where is .

  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.

  The that contains the data to copy. A 32-bit integer that represents the index in the at which copying begins. The that receives the data. A 32-bit integer that represents the index in the at which storing begins. A 32-bit integer that represents the number of elements to copy.
- Method
  2.0.0.0
  4.0.0.0
  TOutput[] `` `` is or is .

  The is a delegate to a method that converts an object to the target type. The elements of are individually passed to the , and the converted elements are saved in the new array.

  The source remains unchanged.

  This method is an O() operation, where is the of .

  Converts an array of one type to an array of another type.

  An array of the target type containing the converted elements from the source array.

  The one-dimensional, zero-based to convert to a target type. A that converts each element from one type to another type. The type of the elements of the source array. The type of the elements of the target array.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` ``

  or is .

  and have different ranks.

  The elements in both arrays are built-in types, and converting from the type of the elements of into the type of the elements in requires a narrowing conversion.

  -or-

  Both arrays are built-in types, and one array is a value-type array and the other an array of interface type not implemented by that value-type.

  -or-

  Both arrays are user-defined value types and are not of the same type.

  At least one of the elements in is not assignment-compatible with the type of .

  < 0.

  > .Length.

  -or-

  > .Length.

  This example demonstrates the method.

  `using System; public class ArrayCopyExample { public static void Main() { int[] intAryOrig = new int[3]; double[] dAryCopy = new double[3]; for ( int i = 0; i < intAryOrig.Length; i++ ) intAryOrig[i] = i+3; //copy the first 2 elements of the source into the destination Array.Copy( intAryOrig, dAryCopy, 2); Console.Write( "The elements of the first array are: " ); for ( int i = 0; i < intAryOrig.Length; i++ ) Console.Write( "{0,3}", intAryOrig[i] ); Console.WriteLine(); Console.Write( "The elements of the copied array are: " ); for ( int i = 0; i < dAryCopy.Length; i++ ) Console.Write( "{0,3}", dAryCopy[i] ); } }`

  The output is

  The elements of the first array are: 3 4 5

  The elements of the copied array are: 3 4 0

  The and parameters must have the same number of dimensions. In addition, must already have been dimensioned and must have a sufficient number of elements to accommodate the copied data.

  When copying between multidimensional arrays, the array behaves like a long one-dimensional array, where the rows (or columns) are conceptually laid end to end. For example, if an array has three rows (or columns) with four elements each, copying six elements from the beginning of the array would copy all four elements of the first row (or column) and the first two elements of the second row (or column).

  If and overlap, this method behaves as if the original values of were preserved in a temporary location before is overwritten.

  [C++]

  This method is equivalent to the standard C/C++ function memmove, not memcpy.

  The arrays can be reference-type arrays or value-type arrays. Type downcasting is performed, as required.

  When copying from a reference-type array to a value-type array, each element is unboxed and then copied. When copying from a value-type array to a reference-type array, each element is boxed and then copied.

  When copying from a reference-type or value-type array to an array, an is created to hold each value or reference and then copied. When copying from an array to a reference-type or value-type array and the assignment is not possible, an is thrown.

  If and are both reference-type arrays or are both arrays of type , a shallow copy is performed. A shallow copy of an is a new containing references to the same elements as the original . The elements themselves or anything referenced by the elements are not copied. In contrast, a deep copy of an copies the elements and everything directly or indirectly referenced by the elements.

  An is thrown if the arrays are of incompatible types. Type compatibility is defined as follows:

  A type is compatible with itself.

  A value type is compatible with and with an interface type implemented by that value type. A value type is considered connected to an interface only if it implements that interface directly. Disconnected types are not compatible.

  Two intrinsic (predefined) value types are compatible if copying from the source type to the destination type is a widening conversion. A widening conversion never loses information, whereas a narrowing conversion can lose information. For example, converting a 32-bit signed integer to a 64-bit signed integer is a widening conversion, and converting a 64-bit signed integer to a 32-bit signed integer is a narrowing conversion. For more information about conversions, see .

  A nonintrinsic (user-defined) value type is compatible only with itself.

  Enumerations have an implicit conversion to and to their underlying type.

  If every element in requires a downcast (for example, from a base class to a derived class or from an interface to an object) and one or more elements cannot be cast to the corresponding type in , an is thrown.

  If this method throws an exception while copying, the state of is undefined.

  This method is an O() operation, where is .

  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.

  The that contains the data to copy. The that receives the data. A 32-bit integer that represents the number of elements to copy. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` ``

  The and parameters must have the same number of dimensions. In addition, must already have been dimensioned and must have a sufficient number of elements to accommodate the copied data.

  When copying between multidimensional arrays, the array behaves like a long one-dimensional array, where the rows (or columns) are conceptually laid end to end. For example, if an array has three rows (or columns) with four elements each, copying six elements from the beginning of the array would copy all four elements of the first row (or column) and the first two elements of the second row (or column).

  If and overlap, this method behaves as if the original values of were preserved in a temporary location before is overwritten.

  [C++]

  This method is equivalent to the standard C/C++ function memmove, not memcpy.

  The arrays can be reference-type arrays or value-type arrays. Type downcasting is performed, as required.

  When copying from a reference-type array to a value-type array, each element is unboxed and then copied. When copying from a value-type array to a reference-type array, each element is boxed and then copied.

  When copying from a reference-type or value-type array to an array, an is created to hold each value or reference and then copied. When copying from an array to a reference-type or value-type array and the assignment is not possible, an is thrown.

  If and are both reference-type arrays or are both arrays of type , a shallow copy is performed. A shallow copy of an is a new containing references to the same elements as the original . The elements themselves or anything referenced by the elements are not copied. In contrast, a deep copy of an copies the elements and everything directly or indirectly referenced by the elements.

  An is thrown if the arrays are of incompatible types. Type compatibility is defined as follows:

  A type is compatible with itself.

  A value type is compatible with and with an interface type implemented by that value type. A value type is considered connected to an interface only if it implements that interface directly. Disconnected types are not compatible.

  Two intrinsic (predefined) value types are compatible if copying from the source type to the destination type is a widening conversion. A widening conversion never loses information, whereas a narrowing conversion can lose information. For example, converting a 32-bit signed integer to a 64-bit signed integer is a widening conversion, and converting a 64-bit signed integer to a 32-bit signed integer is a narrowing conversion. For more information about conversions, see .

  A nonintrinsic (user-defined) value type is compatible only with itself.

  Enumerations have an implicit conversion to and to their underlying type.

  If every element in requires a downcast (for example, from a base class to a derived class or from an interface to an object) and one or more elements cannot be cast to the corresponding type in , an is thrown.

  If this method throws an exception while copying, the state of is undefined.

  This method is an O() operation, where is .

  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.

  The that contains the data to copy. The that receives the data. A 64-bit integer that represents the number of elements to copy. The integer must be between zero and , inclusive.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` `` `` ``

  or is .

  and have different ranks.

  The elements in both arrays are built-in types, and converting from the type of the elements of into the type of the elements in requires a narrowing conversion.

  -or-

  Both arrays are built-in types, and one array is a value-type array and the other an array of interface type not implemented by that value-type.

  -or-

  Both arrays are user-defined value types and are not of the same type.

  At least one element in is assignment-incompatible with the type of .

  < .GetLowerBound(0).

  -or-

  < .GetLowerBound(0).

  -or-

  < 0.

  ( + ) > (.GetLowerBound(0) + .Length).

  ( + ) > ( .GetLowerBound(0) + .Length).

  This example demonstrates the method.

  `using System; class ArrayCopyExample { public static void Main() { int[] intAry = { 0, 10, 20, 30, 40, 50 }; Console.Write( "The elements of the array are: " ); foreach ( int i in intAry ) Console.Write( "{0,3}", i ); Console.WriteLine(); Array.Copy( intAry, 2, intAry, 0, 4 ); Console.WriteLine( "After copying elements 2 through 5 into elements 0 through 4" ); Console.Write( "The elements of the array are: " ); foreach ( int i in intAry ) Console.Write( "{0,3}", i ); Console.WriteLine(); } }`

  The output is

  The elements of the array are: 0 10 20 30 40 50

  After copying elements 2 through 5 into elements 0 through 4

  The elements of the array are: 20 30 40 50 40 50

  The and parameters must have the same number of dimensions. In addition, must already have been dimensioned and must have a sufficient number of elements starting from the position to accommodate the copied data.

  When copying between multidimensional arrays, the array behaves like a long one-dimensional array, where the rows (or columns) are conceptually laid end-to-end. For example, if an array has three rows (or columns) with four elements each, copying six elements from the beginning of the array would copy all four elements of the first row (or column) and the first two elements of the second row (or column). To start copying from the second element of the third row (or column), must be the upper bound of the first row (or column) plus the length of the second row (or column) plus two.

  If and overlap, this method behaves as if the original values of were preserved in a temporary location before is overwritten.

  [C++]

  This method is equivalent to the standard C/C++ function memmove, not memcpy.

  The arrays can be reference-type arrays or value-type arrays. Type downcasting is performed, as required.

  When copying from a reference-type array to a value-type array, each element is unboxed and then copied. When copying from a value-type array to a reference-type array, each element is boxed and then copied.

  When copying from a reference-type or value-type array to an array, an is created to hold each value or reference and then copied. When copying from an array to a reference-type or value-type array and the assignment is not possible, an is thrown.

  If and are both reference-type arrays or are both arrays of type , a shallow copy is performed. A shallow copy of an is a new containing references to the same elements as the original . The elements themselves or anything referenced by the elements are not copied. In contrast, a deep copy of an copies the elements and everything directly or indirectly referenced by the elements.

  An is thrown if the arrays are of incompatible types. Type compatibility is defined as follows:

  A type is compatible with itself.

  A value type is compatible with and with an interface type implemented by that value type. A value type is considered connected to an interface only if it implements that interface directly. Disconnected types are not compatible.

  Two intrinsic (predefined) value types are compatible if copying from the source type to the destination type is a widening conversion. A widening conversion never loses information, whereas a narrowing conversion can lose information. For example, converting a 32-bit signed integer to a 64-bit signed integer is a widening conversion, and converting a 64-bit signed integer to a 32-bit signed integer is a narrowing conversion. For more information about conversions, see .

  A nonintrinsic (user-defined) value type is compatible only with itself.

  Enumerations have an implicit conversion to and to their underlying type.

  If every element in requires a downcast (for example, from a base class to a derived class or from an interface to an object) and one or more elements cannot be cast to the corresponding type in , an is thrown.

  If this method throws an exception while copying, the state of is undefined.

  This method is an O() operation, where is .

  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.

  The that contains the data to copy. A 32-bit integer that represents the index in the at which copying begins. The that receives the data. A 32-bit integer that represents the index in the at which storing begins. A 32-bit integer that represents the number of elements to copy. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` `` `` ``

  The and parameters must have the same number of dimensions. In addition, must already have been dimensioned and must have a sufficient number of elements starting from the position to accommodate the copied data.

  When copying between multidimensional arrays, the array behaves like a long one-dimensional array, where the rows (or columns) are conceptually laid end-to-end. For example, if an array has three rows (or columns) with four elements each, copying six elements from the beginning of the array would copy all four elements of the first row (or column) and the first two elements of the second row (or column). To start copying from the second element of the third row (or column), must be the upper bound of the first row (or column) plus the length of the second row (or column) plus two.

  If and overlap, this method behaves as if the original values of were preserved in a temporary location before is overwritten.

  [C++]

  This method is equivalent to the standard C/C++ function memmove, not memcpy.

  The arrays can be reference-type arrays or value-type arrays. Type downcasting is performed, as required.

  When copying from a reference-type array to a value-type array, each element is unboxed and then copied. When copying from a value-type array to a reference-type array, each element is boxed and then copied.

  When copying from a reference-type or value-type array to an array, an is created to hold each value or reference and then copied. When copying from an array to a reference-type or value-type array and the assignment is not possible, an is thrown.

  If and are both reference-type arrays or are both arrays of type , a shallow copy is performed. A shallow copy of an is a new containing references to the same elements as the original . The elements themselves or anything referenced by the elements are not copied. In contrast, a deep copy of an copies the elements and everything directly or indirectly referenced by the elements.

  An is thrown if the arrays are of incompatible types. Type compatibility is defined as follows:

  A type is compatible with itself.

  A value type is compatible with and with an interface type implemented by that value type. A value type is considered connected to an interface only if it implements that interface directly. Disconnected types are not compatible.

  Two intrinsic (predefined) value types are compatible if copying from the source type to the destination type is a widening conversion. A widening conversion never loses information, whereas a narrowing conversion can lose information. For example, converting a 32-bit signed integer to a 64-bit signed integer is a widening conversion, and converting a 64-bit signed integer to a 32-bit signed integer is a narrowing conversion. For more information about conversions, see .

  A nonintrinsic (user-defined) value type is compatible only with itself.

  Enumerations have an implicit conversion to and to their underlying type.

  If every element in requires a downcast (for example, from a base class to a derived class or from an interface to an object) and one or more elements cannot be cast to the corresponding type in , an is thrown.

  If this method throws an exception while copying, the state of is undefined.

  This method is an O() operation, where is .

  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.

  The that contains the data to copy. A 64-bit integer that represents the index in the at which copying begins. The that receives the data. A 64-bit integer that represents the index in the at which storing begins. A 64-bit integer that represents the number of elements to copy. The integer must be between zero and , inclusive.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` is .

  The current instance has more than one dimension.

  < .

  has more than one dimension.

  -or-

  ( + Length of the current instance) > ( + ).

  -or-

  The number of elements in the current instance is greater than the available space from to the end of .

  The element type of the current instance is not assignment-compatible with the element type of .

  The following example shows how to copy the elements of one into another.

  `using System; public class ArrayCopyToExample { public static void Main() { Array aryOne = Array.CreateInstance(typeof(Object), 3); aryOne.SetValue("one", 0); aryOne.SetValue("two", 1); aryOne.SetValue("three", 2); Array aryTwo = Array.CreateInstance(typeof(Object), 5); for (int i=0; i < aryTwo.Length; i++) aryTwo.SetValue(i, i); Console.WriteLine("The contents of the first array are:"); foreach (object o in aryOne) Console.Write("{0} ", o); Console.WriteLine(); Console.WriteLine("The original contents of the second array are:"); foreach (object o in aryTwo) Console.Write("{0} ", o); Console.WriteLine(); aryOne.CopyTo(aryTwo, 1); Console.WriteLine("The new contents of the second array are:"); foreach( object o in aryTwo) Console.Write("{0} ", o); } }`

  The output is

  The contents of the first array are:

  one two three

  The original contents of the second array are:

  0 1 2 3 4

  The new contents of the second array are:

  0 one two three 4

  This method copies all the elements of the current array instance to the destination array, starting at index . The destination array must already have been dimensioned and must have a sufficient number of elements to accommodate the copied elements. Otherwise, the method throws an exception.

  This method supports the interface. If implementing is not explicitly required, use to avoid an extra indirection.

  If this method throws an exception while copying, the state of is undefined.

  This method is an O() operation, where is . It performs a shallow copy only.

  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.

  The one-dimensional array that is the destination of the elements copied from the current array. A 32-bit integer that represents the index in at which copying begins. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void `` ``

  This method copies all the elements of the current array instance to the destination array, starting at index . The destination array must already have been dimensioned and must have a sufficient number of elements to accommodate the copied elements. Otherwise, the method throws an exception.

  This method supports the interface. If implementing is not explicitly required, use to avoid an extra indirection.

  If this method throws an exception while copying, the state of is undefined.

  This method is an O() operation, where is . It performs a shallow copy only.

  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.

  The one-dimensional array that is the destination of the elements copied from the current array. A 64-bit integer that represents the index in at which copying begins.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Array `` `` is . is not a valid . < 0.

  The following example shows how to create and initialize a one-dimensional .

  `using System; public class ArrayCreateInstanceExample { public static void Main() { Array intAry = Array.CreateInstance(typeof(int),5); for (int i=intAry.GetLowerBound(0);i<=intAry.GetUpperBound(0);i++) intAry.SetValue(i*3,i); Console.Write("The values of the array are:"); foreach (int i in intAry) Console.Write("{0} ",i); } }`

  The output is

  The values of the array are: 0 3 6 9 12

  Unlike most classes, provides the method, instead of public constructors, to allow for late bound access.

  Reference-type elements are initialized to null. Value-type elements are initialized to zero.

  This method is an O() operation, where is .

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

  A new one-dimensional of the specified with the specified length, using zero-based indexing.

  The of the to create. The size of the to create. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Array `` `System.ParamArray`

  or is .

  is not a valid .

  -or-

  .Length = 0.

  A value in is less than zero.

  The following example shows how to create and initialize a multidimensional .

  `using System; public class CreateMultiDimArrayExample { public static void Main() { int i, j, k; int[] indexAry = {2, 4, 5}; Array ary = Array.CreateInstance( typeof(int), indexAry ); for( i = ary.GetLowerBound(0); i <= ary.GetUpperBound(0); i++ ) { for( j = ary.GetLowerBound(1); j <= ary.GetUpperBound(1); j++ ) { for( k = ary.GetLowerBound(2); k <= ary.GetUpperBound(2); k++ ) { ary.SetValue( (100*i + 10*j + k), i, j, k ); } } } Console.WriteLine("The elements of the array are:"); for( i = ary.GetLowerBound(0); i <= ary.GetUpperBound(0); i++) { for( j = ary.GetLowerBound(1); j <= ary.GetUpperBound(1); j++) { for( k = ary.GetLowerBound(2); k <= ary.GetUpperBound(2); k++ ) { Console.Write("{0, 3} ", ary.GetValue(i, j, k)); } Console.WriteLine(); } Console.WriteLine(); } } }`

  The output is

  `The elements of the array are: 0 1 2 3 4 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 100 101 102 103 104 110 111 112 113 114 120 121 122 123 124 130 131 132 133 134`

  Unlike most classes, provides the method, instead of public constructors, to allow for late bound access.

  The number of elements in the array must equal the number of dimensions in the new . Each element of the array must specify the length of the corresponding dimension in the new .

  Reference-type elements are initialized to null. Value-type elements are initialized to zero.

  This method is an O() operation, where is the product of all values in .

  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.

  A new multidimensional of the specified with the specified length for each dimension, using zero-based indexing.

  The of the to create. An array of 32-bit integers that represent the size of each dimension of the to create. 1 ExtendedArray
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Array `` `System.ParamArray`

  Unlike most classes, provides the method, instead of public constructors, to allow for late bound access.

  The number of elements in the array must equal the number of dimensions in the new . Each element of the array must specify the length of the corresponding dimension in the new .

  Reference-type elements are initialized to null. Value-type elements are initialized to zero.

  This method is an O() operation, where is the product of all values in .

  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.

  A new multidimensional of the specified with the specified length for each dimension, using zero-based indexing.

  The of the to create. 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.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Array `` `` `` is . is not a valid .

  < 0.

  -or-

  < 0.

  The following example shows how to create and initialize a two-dimensional .

  `using System; public class Create2DArrayExample { public static void Main() { int i, j; Array ary = Array.CreateInstance( typeof(int), 5, 3 ); for( i = ary.GetLowerBound(0); i <= ary.GetUpperBound(0); i++ ) { for( j = ary.GetLowerBound(1); j <= ary.GetUpperBound(1); j++ ) { ary.SetValue( (10*i + j), i, j ); } } Console.WriteLine("The elements of the array are:"); for( i = ary.GetLowerBound(0); i <= ary.GetUpperBound(0); i++) { for( j = ary.GetLowerBound(1); j <= ary.GetUpperBound(1); j++) { Console.Write("{0, 2} ", ary.GetValue(i, j)); } Console.WriteLine(); } } }`

  The output is

  `The elements of the array are: 0 1 2 10 11 12 20 21 22 30 31 32 40 41 42`

  Unlike most classes, provides the method, instead of public constructors, to allow for late bound access.

  Reference-type elements are initialized to null. Value-type elements are initialized to zero.

  This method is an O() operation, where is the product of and .

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

  A new two-dimensional of the specified with the specified length for each dimension, using zero-based indexing.

  The of the to create. The size of the first dimension of the to create. The size of the second dimension of the to create. 1 ExtendedArray
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Array `` `` ``

  , , or is .

  is not a valid .

  -or-

  .Length = 0.

  -or-

  and do not contain the same number of elements.

  A value in is less than zero.

  The following example shows how to create and initialize a multidimensional with specified low bounds.

  `using System; public class MultiDimNonZeroBoundExample { public static void Main() { int i, j, k; int[] indexAry = {4, 2, 3}; int[] lowboundAry = {3, 2, 1}; Array ary = Array.CreateInstance( typeof(int), indexAry, lowboundAry ); for( i = ary.GetLowerBound(0); i <= ary.GetUpperBound(0); i++ ) { for( j = ary.GetLowerBound(1); j <= ary.GetUpperBound(1); j++ ) { for( k = ary.GetLowerBound(2); k <= ary.GetUpperBound(2); k++ ) { ary.SetValue( (100*i + 10*j + k), i, j, k ); } } } Console.WriteLine("The elements of the array are:"); for( i = ary.GetLowerBound(0); i <= ary.GetUpperBound(0); i++) { for( j = ary.GetLowerBound(1); j <= ary.GetUpperBound(1); j++) { for( k = ary.GetLowerBound(2); k <= ary.GetUpperBound(2); k++ ) { Console.Write("{0, 3} ", ary.GetValue(i, j, k)); } Console.WriteLine(); } Console.WriteLine(); } } }`

  The output is

  `The elements of the array are: 321 322 323 331 332 333 421 422 423 431 432 433 521 522 523 531 532 533 621 622 623 631 632 633`

  Unlike most classes, provides the method, instead of public constructors, to allow for late bound access.

  The and arrays must have the same number of elements. The number of elements in the array must equal the number of dimensions in the new .

  Each element of the array must specify the length of the corresponding dimension in the new .

  Each element of the array must specify the lower bound of the corresponding dimension in the new . Generally, the .NET Framework class library and many programming languages do not handle nonzero lower bounds.

  Reference-type elements are initialized to null. Value-type elements are initialized to zero.

  This method is an O() operation, where is the product of all values in .

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

  A new multidimensional of the specified with the specified length and lower bound for each dimension.

  The of the to create. A one-dimensional array that contains the size of each dimension of the to create. A one-dimensional array that contains the lower bound (starting index) of each dimension of the to create. 1 ExtendedArray
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Array `` `` `` `` is . is not a valid .

  < 0.

  -or-

  < 0.

  -or-

  < 0.

  The following example shows how to create and initialize a three-dimensional .

  `using System; public class Create3DArrayExample { public static void Main() { int i, j, k; Array ary = Array.CreateInstance( typeof(int), 2, 4, 3 ); for( i = ary.GetLowerBound(0); i <= ary.GetUpperBound(0); i++ ) { for( j = ary.GetLowerBound(1); j <= ary.GetUpperBound(1); j++ ) { for( k = ary.GetLowerBound(2); k <= ary.GetUpperBound(2); k++ ) { ary.SetValue( (100*i + 10*j + k), i, j, k ); } } } Console.WriteLine("The elements of the array are:"); for( i = ary.GetLowerBound(0); i <= ary.GetUpperBound(0); i++) { for( j = ary.GetLowerBound(1); j <= ary.GetUpperBound(1); j++) { for( k = ary.GetLowerBound(2); k <= ary.GetUpperBound(2); k++ ) { Console.Write("{0, 3} ", ary.GetValue(i, j, k)); } Console.WriteLine(); } Console.WriteLine(); } } }`

  The output is

  `The elements of the array are: 0 1 2 10 11 12 20 21 22 30 31 32 100 101 102 110 111 112 120 121 122 130 131 132`

  Unlike most classes, provides the method, instead of public constructors, to allow for late bound access.

  Reference-type elements are initialized to null. Value-type elements are initialized to zero.

  This method is an O() operation, where is the product of , , and .

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

  A new three-dimensional of the specified with the specified length for each dimension, using zero-based indexing.

  The of the to create. The size of the first dimension of the to create. The size of the second dimension of the to create. The size of the third dimension of the to create. 1 ExtendedArray
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean `` `` or is .

  The is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate. The elements of are individually passed to the , and processing is stopped when a match is found.

  This method is an O() operation, where is the of .

  Determines whether the specified array contains elements that match the conditions defined by the specified predicate.

  true if contains one or more elements that match the conditions defined by the specified predicate; otherwise, false.

  The one-dimensional, zero-based to search. The that defines the conditions of the elements to search for. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  T `` `` or is .

  The is a delegate to a method or a lambda expression that returns true if the object passed to it matches the conditions defined in the delegate or lambda expression. The elements of are individually passed to the , starting with the first element and ending with the last element. Processing is stopped when a match is found.

  This method is an O() operation, where is the of .

  Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire .

  The first element that matches the conditions defined by the specified predicate, if found; otherwise, the default value for type .

  The one-dimensional, zero-based array to search. The predicate that defines the conditions of the element to search for. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  T[] `` `` or is .

  The is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate. The elements of are individually passed to the , and the elements that match the conditions are saved in the returned array.

  This method is an O() operation, where is the of .

  Retrieves all the elements that match the conditions defined by the specified predicate.

  An containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty .

  The one-dimensional, zero-based to search. The that defines the conditions of the elements to search for. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` or is .

  The is searched forward starting at the first element and ending at the last element.

  The is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate. The elements of are individually passed to the .

  This method is an O() operation, where is the of .

  Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire .

  The zero-based index of the first occurrence of an element that matches the conditions defined by , if found; otherwise, –1.

  The one-dimensional, zero-based to search. The that defines the conditions of the element to search for. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` or is . is less than zero or greater than .

  The is searched forward starting at and ending at the last element.

  The is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate. The elements of are individually passed to the .

  This method is an O() operation, where is the number of elements from to the end of .

  Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the that extends from the specified index to the last element.

  The zero-based index of the first occurrence of an element that matches the conditions defined by , if found; otherwise, –1.

  The one-dimensional, zero-based to search. The zero-based starting index of the search. The that defines the conditions of the element to search for. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` or is .

  is less than zero.

  -or-

  is less than zero.

  -or-

  + is greater than .

  The is searched forward starting at and ending at plus minus 1, if is greater than 0.

  The is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate. The elements of are individually passed to the .

  This method is an O() operation, where is .

  Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the that starts at the specified index and contains the specified number of elements.

  The zero-based index of the first occurrence of an element that matches the conditions defined by , if found; otherwise, –1.

  The one-dimensional, zero-based to search. The zero-based starting index of the search. The number of elements in the section to search. The that defines the conditions of the element to search for. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  T `` `` or is .

  The is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate. The elements of are individually passed to the , moving backward in the , starting with the last element and ending with the first element. Processing is stopped when a match is found.

  This method is an O() operation, where is the of .

  Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire .

  The last element that matches the conditions defined by the specified predicate, if found; otherwise, the default value for type .

  The one-dimensional, zero-based to search. The that defines the conditions of the element to search for. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` or is .

  The is searched backward starting at the last element and ending at the first element.

  The is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate. The elements of are individually passed to the .

  This method is an O() operation, where is the of .

  Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire .

  The zero-based index of the last occurrence of an element that matches the conditions defined by , if found; otherwise, –1.

  The one-dimensional, zero-based to search. The that defines the conditions of the element to search for. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` or is . is less than zero or greater than .

  The is searched backward starting at and ending at the first element.

  The is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate. The elements of are individually passed to the .

  This method is an O() operation, where is the number of elements from the beginning of to .

  Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the that extends from the first element to the specified index.

  The zero-based index of the last occurrence of an element that matches the conditions defined by , if found; otherwise, –1.

  The one-dimensional, zero-based to search. The zero-based starting index of the backward search. The that defines the conditions of the element to search for. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` or is .

  is less than zero or greater than .

  -or-

  is less than zero.

  -or-

  is greater than + 1.

  The is searched backward starting at and ending at minus plus 1, if is greater than 0.

  The is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate. The elements of are individually passed to the .

  This method is an O() operation, where is .

  Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the that contains the specified number of elements and ends at the specified index.

  The zero-based index of the last occurrence of an element that matches the conditions defined by , if found; otherwise, –1.

  The one-dimensional, zero-based to search. The zero-based starting index of the backward search. The number of elements in the section to search. The that defines the conditions of the element to search for. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` or is .

  The is a delegate to a method that performs an action on the object passed to it. The elements of are individually passed to the .

  This method is an O() operation, where is the of .

  Performs the specified action on each element of the specified array.

  The one-dimensional, zero-based on whose elements the action is to be performed. The to perform on each element of . The type of the elements of the array.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.IEnumerator

  This example demonstrates the method.

  `using System; using System.Collections; public class ArrayGetEnumerator { public static void Main() { string[,] strAry = {{"1","one"}, {"2", "two"}, {"3", "three"}}; Console.Write( "The elements of the array are: " ); IEnumerator sEnum = strAry.GetEnumerator(); while ( sEnum.MoveNext() ) Console.Write( " {0}", sEnum.Current ); } }`

  The output is

  The elements of the array are: 1 one 2 two 3 three

  [Visual Basic, C#]

  The foreach statement of the C# language (for each in C++, For Each in Visual Basic) hides the complexity of the enumerators. Therefore, using foreach is recommended, instead of directly manipulating the enumerator.

  Enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection.

  Initially, the enumerator is positioned before the first element in the collection. also brings the enumerator back to this position. At this position, is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .

  returns the same object until either or is called. sets to the next element.

  If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns false. When the enumerator is at this position, subsequent calls to also return false. If the last call to returned false, is undefined. To set to the first element of the collection again, you can call followed by .

  An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and its behavior is undefined.

  The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.

  This method is an O(1) operation.

  Returns an for the .

  An for the .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  is less than zero.

  -or-

  is equal to or greater than .

  An example of is GetLength(0), which returns the number of elements in the first dimension of the .

  This method is an O(1) operation.

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

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

  A zero-based dimension of the whose length needs to be determined.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Int64 ``

  An example of is GetLongLength(0), which returns the number of elements in the first dimension of the .

  This method is an O(1) operation.

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

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

  A zero-based dimension of the whose length needs to be determined.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
  System.Int32 ``

  < 0.

  -or-

  is equal to or greater than the property of the current instance.

  GetLowerBound(0) returns the starting index of the first dimension of the array, and GetLowerBound(Rank - 1) returns the starting index of the last dimension of the array.

  The method always returns a value that indicates the index of the lower bound of the array, even if the array is empty.

  Note that, although most arrays in the .NET Framework are zero-based (that is, the method returns zero for each dimension of an array), the .NET Framework does support arrays that are not zero-based. Such arrays can be created with the method, and can also be returned from unmanaged code.

  This method is an O(1) operation.

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

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

  A zero-based dimension of the array whose starting index needs to be determined. 1 RuntimeInfrastructure
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
  System.Int32 ``

  < 0.

  -or-

  is equal to or greater than the property of the current instance.

  GetUpperBound(0) returns the last index in the first dimension of the array, and GetUpperBound(Rank - 1) returns the last index of the last dimension of the array.

  This method is an O(1) operation.

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

  The index of the last element of the specified dimension in the array, or -1 if the specified dimension is empty.

  A zero-based dimension of the array whose upper bound needs to be determined. 1 RuntimeInfrastructure
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object `` The current instance has more than one dimension.

  is outside the range of valid indices for the current instance.

  This example demonstrates the method.

  `using System; public class ArrayGetValueExample { public static void Main() { String[] strAry = { "one", "two", "three", "four", "five" }; Console.Write( "The elements of the array are: " ); for( int i = 0; i < strAry.Length; i++ ) Console.Write( " '{0}' ", strAry.GetValue( i ) ); } }`

  The output is

  The elements of the array are: 'one' 'two' 'three' 'four' 'five'

  The and methods can determine whether the value of is out of bounds.

  This method is an O(1) operation.

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

  The value at the specified position in the one-dimensional .

  A 32-bit integer that represents the position of the element to get. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object `System.ParamArray` is . The number of dimensions in the current instance is not equal to the number of elements in .

  At least one element in is outside the range of valid indices for the corresponding dimension of the current instance.

  The number of elements in must equal the number of dimensions in the . All elements in the array must collectively specify the position of the desired element in the multidimensional .

  The and methods can determine whether any of the indexes is out of bounds.

  This method is an O(1) operation.

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

  The value at the specified position in the multidimensional .

  A one-dimensional array of 32-bit integers that represent the indexes specifying the position of the element to get. 1 ExtendedArray
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Object ``

  The and methods can determine whether the value of is out of bounds.

  This method is an O(1) operation.

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

  The value at the specified position in the one-dimensional .

  A 64-bit integer that represents the position of the element to get.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Object `System.ParamArray`

  The number of elements in must equal the number of dimensions in the . All elements in the array must collectively specify the position of the desired element in the multidimensional .

  The and methods can determine whether any of the indexes is out of bounds.

  This method is an O(1) operation.

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

  The value at the specified position in the multidimensional .

  A one-dimensional array of 64-bit integers that represent the indexes specifying the position of the element to get.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object `` `` The current instance does not have exactly two dimensions. At least one of or is outside the range of valid indexes for the corresponding dimension of the current instance.

  The and methods can determine whether any of the indexes is out of bounds.

  This method is an O(1) operation.

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

  The value at the specified position in the two-dimensional .

  A 32-bit integer that represents the first-dimension index of the element to get. A 32-bit integer that represents the second-dimension index of the element to get. 1 ExtendedArray
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Object `` ``

  The and methods can determine whether any of the indexes is out of bounds.

  This method is an O(1) operation.

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

  The value at the specified position in the two-dimensional .

  A 64-bit integer that represents the first-dimension index of the element to get. A 64-bit integer that represents the second-dimension index of the element to get.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object `` `` `` The current instance does not have exactly three dimensions.

  At least one of or or is outside the range of valid indexes for the corresponding dimension of the current instance.

  The and methods can determine whether any of the indexes is out of bounds.

  This method is an O(1) operation.

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

  The value at the specified position in the three-dimensional .

  A 32-bit integer that represents the first-dimension index of the element to get. A 32-bit integer that represents the second-dimension index of the element to get. A 32-bit integer that represents the third-dimension index of the element to get. 1 ExtendedArray
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Object `` `` ``

  The and methods can determine whether any of the indexes is out of bounds.

  This method is an O(1) operation.

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

  The value at the specified position in the three-dimensional .

  A 64-bit integer that represents the first-dimension index of the element to get. A 64-bit integer that represents the second-dimension index of the element to get. A 64-bit integer that represents the third-dimension index of the element to get.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` is . has more than one dimension.

  The following example demonstrates the method.

  `using System; public class ArrayIndexOfExample { public static void Main() { int[] intAry = { 0, 1, 2, 0, 1 }; Console.Write( "The values of the array are: " ); foreach( int i in intAry ) Console.Write( "{0,5}", i ); Console.WriteLine(); int j = Array.IndexOf( intAry, 1 ); Console.WriteLine( "The first occurrence of 1 is at index {0}", j ); } }`

  The output is

  The values of the array are: 0 1 2 0 1

  The first occurrence of 1 is at index 1

  The one-dimensional is searched forward starting at the first element and ending at the last element.

  The elements are compared to the specified value using the method. If the element type is a nonintrinsic (user-defined) type, the Equals implementation of that type is used.

  Since most arrays will have a lower bound of zero, this method would generally return –1 when is not found. In the rare case that the lower bound of the array is equal to and is not found, this method returns , which is System.Int32.MinValue - 1.

  This method is an O() operation, where is the of .

  In the .NET Framework version 2.0, this method uses the and methods of the to determine whether the specified by the parameter exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the itself.

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

  The index of the first occurrence of within the entire , if found; otherwise, the lower bound of the array minus 1.

  The one-dimensional to search. The object to locate in . 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` ``

  is .

  is less than or greater than + .

  has more than one dimension.

  The one-dimensional is searched forward starting at and ending at the last element.

  The elements are compared to the specified value using the method. If the element type is a nonintrinsic (user-defined) type, the Equals implementation of that type is used.

  Since most arrays will have a lower bound of zero, this method would generally return –1 when is not found. In the rare case that the lower bound of the array is equal to and is not found, this method returns , which is System.Int32.MinValue - 1.

  Passing the of the array as the will result in a return value of -1, while values greater than Length will raise an .

  This method is an O() operation, where is the number of elements from to the end of .

  In the .NET Framework version 2.0, this method uses the and methods of the to determine whether the specified by the parameter exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the itself.

  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.

  The index of the first occurrence of within the range of elements in that extends from to the last element, if found; otherwise, the lower bound of the array minus 1.

  The one-dimensional to search. The object to locate in . The starting index of the search. 0 (zero) is valid in an empty array. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` `` ``

  is .

  is less than .

  -or-

  is less than zero.

  -or-

  + is greater than + .

  has more than one dimension.

  The one-dimensional is searched forward starting at and ending at plus minus 1, if is greater than 0.

  The elements are compared to the specified value using the method. If the element type is a nonintrinsic (user-defined) type, the Equals implementation of that type is used.

  Since most arrays will have a lower bound of zero, this method would generally return –1 when is not found. In the rare case that the lower bound of the array is equal to and is not found, this method returns , which is System.Int32.MinValue - 1.

  Passing the of the array as the will result in a return value of -1, while values greater than Length will raise an .

  This method is an O() operation, where is .

  In the .NET Framework version 2.0, this method uses the and methods of the to determine whether the specified by the parameter exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the itself.

  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.

  The index of the first occurrence of within the range of elements in that starts at and contains the number of elements specified in , if found; otherwise, the lower bound of the array minus 1.

  The one-dimensional to search. The object to locate in . The starting index of the search. 0 (zero) is valid in an empty array. The number of elements in the section to search. 0
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` To be added. The array to search. The value to locate.

  Searches the specified array, returning the index of the first occurrence of the specified value.

  The zero-based index of the first occurrence of in , if found; otherwise, - 1.

  The elements are compared using . The array is searched forward starting at the first element and ending at the last element. Processing is stopped when the predicate returns .

  is .

- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` To be added. The array to search. The value to locate. The zero-based starting index of the search.

  Searches the specified array, returning the index of the first occurrence in the specified array starting at the specified index and including the last element.

  The zero-based index of the first occurrence of within the range of elements in that extends from to the last element, if found; otherwise, -1. If is equal to the length of the array, -1 is returned.

  The elements are compared using . The array is searched forward starting at and ending at the last element. Processing is stopped when the predicate returns .

  is .

  is less than zero or greater than .

- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` To be added. The array to search. The value to locate. The zero-based starting index of the search. The number of consecutive elements to search.

  Searches for the specified value and returns the index of the first occurrence within the range of elements in the array starting at the specified index and continuing for, at most, the specified number of elements.

  The zero-based index of the first occurrence of within the range of elements in that starts at and contains the number of elements specified in , if found; otherwise, -1.

  The elements are compared using . The array is searched forward starting at and ending at + - 1. Processing is stopped when the predicate returns .

  is .

  is less than zero.

  -or-

  is less than zero.

  -or-

  + is greater than .

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  This method is designed to help compilers support value-type arrays; most users do not need this method. It must not be used on reference-type arrays.

  If the is not a value-type or if the value type does not have a default constructor, the is not modified.

  The value-type can have any lower bound and any number of dimensions.

  This method is an O() operation, where is .

  You can use this method only on value types that have constructors; however, value types that are native to C# do not have constructors.

  Initializes every element of the value-type by calling the default constructor of the value type.

  1
  RuntimeInfrastructure
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  implements the property because it is required by the interface.

  An array with a fixed size does not allow the addition or removal of elements after the array is created, but it allows the modification of existing elements.

  Retrieving the value of this property is an O(1) operation.

  Gets a value indicating whether the has a fixed size.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  implements the property because it is required by the interface. An array that is read-only does not allow the addition, removal, or modification of elements after the array is created.

  If you require a read-only collection, use a class that implements the interface.

  If you cast or convert an array to an interface object, the property returns false. However, if you cast or convert an array to a interface, the IsReadOnly property returns true.

  Retrieving the value of this property is an O(1) operation.

  Gets a value indicating whether the is read-only.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  implements the property because it is required by the interface.

  .NET Framework classes based on provide their own synchronized version of the collection using the property.

  Classes that use arrays can also implement their own synchronization using the property. The synchronizing code must perform operations on the SyncRoot of the collection, not directly on the collection. This ensures proper operation of collections that are derived from other objects. Specifically, it maintains proper synchronization with other threads that might be simultaneously modifying the collection. Note that some implementations of might return the itself.

  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.

  Retrieving the value of this property is an O(1) operation.

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

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` is . has more than one dimension.

  The following example demonstrates the method.

  `using System; public class ArrayLastIndexOfExample { public static void Main() { int[] intAry = { 0, 1, 2, 0, 1 }; Console.Write( "The values of the array are: "); foreach( int i in intAry ) Console.Write( "{0,5}", i ); Console.WriteLine(); int j = Array.LastIndexOf( intAry, 1 ); Console.WriteLine( "The last occurrence of 1 is at index {0}", j ); } }`

  The output is

  The values of the array are: 0 1 2 0 1

  The last occurrence of 1 is at index 4

  The one-dimensional is searched backward starting at the last element and ending at the first element.

  The elements are compared to the specified value using the method. If the element type is a nonintrinsic (user-defined) type, the Equals implementation of that type is used.

  Since most arrays will have a lower bound of zero, this method would generally return –1 when is not found. In the rare case that the lower bound of the array is equal to and is not found, this method returns , which is System.Int32.MinValue - 1.

  This method is an O() operation, where is the of .

  In the .NET Framework version 2.0, this method uses the and methods of the to determine whether the specified by the parameter exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the itself.

  methods of the parameter on the objects in the collection.

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

  The index of the last occurrence of within the entire , if found; otherwise, the lower bound of the array minus 1.

  The one-dimensional to search. The object to locate in . 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` ``

  is .

  is outside the range of valid indices for .

  has more than one dimension.

  The one-dimensional is searched backward starting at and ending at the first element.

  The elements are compared to the specified value using the method. If the element type is a nonintrinsic (user-defined) type, the Equals implementation of that type is used.

  Since most arrays will have a lower bound of zero, this method would generally return –1 when is not found. In the rare case that the lower bound of the array is equal to and is not found, this method returns , which is System.Int32.MinValue - 1.

  This method is an O() operation, where is the number of elements from the beginning of to .

  In the .NET Framework version 2.0, this method uses the and methods of the to determine whether the specified by the parameter exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the itself.

  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.

  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.

  The one-dimensional to search. The object to locate in . The starting index of the backward search. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 `` `` `` ``

  is .

  is outside the range of valid indices for .

  -or-

  < 0.

  -or-

  is greater than + 1.

  has more than one dimension.

  The one-dimensional is searched backward starting at and ending at minus plus 1, if is greater than 0.

  The elements are compared to the specified value using the method. If the element type is a nonintrinsic (user-defined) type, the Equals implementation of that type is used.

  Since most arrays will have a lower bound of zero, this method would generally return –1 when is not found. In the rare case that the lower bound of the array is equal to and is not found, this method returns , which is System.Int32.MinValue - 1.

  This method is an O() operation, where is .

  In the .NET Framework version 2.0, this method uses the and methods of the to determine whether the specified by the parameter exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the itself.

  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.

  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.

  The one-dimensional to search. The object to locate in . The starting index of the backward search. The number of elements in the section to search. 0
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` To be added. The array to search. The value to locate.

  Searches the specified array, returning the index of the last occurrence of the specified value.

  The zero-based index of the last occurrence of in , if found; otherwise, - 1.

  The elements are compared using . The array is searched backward starting at the last element and ending at the first element. Processing is stopped when the predicate returns .

  is .

- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` To be added. The array to search. The value to locate. The zero-based starting index of the search.

  Searches the specified array backwards, returning the index of the last occurrence of the specified array, starting at the specified index.

  The zero-based index of the last occurrence of within the range of elements in that extends from to the first element, if found; otherwise, -1.

  The elements are compared using . The array is searched backward starting at and ending at the first element. Processing is stopped when the predicate returns .

  is .

  is outside the range of valid indices for .

- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` To be added. The array to search. The value to locate. The zero-based starting index of the search. The number of consecutive elements to search.

  Searches for the specified value and returns the index of the last occurrence within the range of elements in the array starting at the specified index and continuing backwards for, at most, the specified number of elements.

  The zero-based index of the last occurrence of within the range of elements in that ends at and contains the number of elements specified in , if found; otherwise, -1.

  The elements are compared using . The array is searched backward starting at and going for count elements. Processing is stopped when the predicate returns .

  is .

  is outside the range of valid indices for .

  -or-

  is less than zero.

  -or-

  is greater than + 1.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  get: System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
  System.Int32

  A that contains the total number of elements in all the dimensions of the current instance.

  Retrieving the value of this property is an O(1) operation.

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

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  get: System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
  System.Int64

  A value containing the length of the array.

  Retrieving the value of this property is an O(1) operation.

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

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  get: System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
  System.Int32

  A that contains the rank (number of dimensions) of the current instance.

  For example, the Visual Basic code

  `Dim TDArray(0,0,0) As Integer`

  and the C# code

  `int[,,] TDArray = new int[1,1,1];`

  create an array of three dimensions with a property whose value is 3.

  A jagged array (an array of arrays) is a one-dimensional array; the value of its property is 1.

  Retrieving the value of this property is an O(1) operation.

  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.

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` is . has more than one dimension.

  After a call to this method, the element at myArray[i], where is any index in the array, moves to myArray[j], where equals (myArray.Length + myArray.GetLowerBound(0)) - (i - myArray.GetLowerBound(0)) - 1.

  This method is an O() operation, where is the of .

  As the following example shows, the method can be used to reverse a jagged array. It initializes a jagged array with one element for each month of the current year in the current culture's calendar. Each element contains an array with as many elements as that month has days. The example displays the contents of the array, calls the method, and then displays the contents of the reversed array.

  code reference: System.Array.Reverse#1

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

  The one-dimensional to reverse. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` `` is . is multidimensional.

  < .GetLowerBound(0).

  < 0.

  and do not specify a valid range in (i.e. + > .GetLowerBound(0) + .Length).

  The following example demonstrates the method.

  `using System; public class ArrayReverseExample { public static void Main() { string[] strAry = { "one", "two", "three" }; Console.Write( "The elements of the array are:"); foreach( string str in strAry ) Console.Write( " {0}", str ); Array.Reverse( strAry ); Console.WriteLine(); Console.WriteLine( "After reversing the array," ); Console.Write( "the elements of the array are:"); foreach( string str in strAry ) Console.Write( " {0}", str ); } }`

  The output is

  The elements of the array are: one two three

  After reversing the array,

  the elements of the array are: three two one

  After a call to this method, the element at myArray[i], where is any index in the array, moves to myArray[j], where equals (myArray.Length + myArray.GetLowerBound(0)) - (i - myArray.GetLowerBound(0)) - 1.

  The method can be used to reverse a jagged array.

  This method is an O() operation, where is .

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

  The one-dimensional to reverse. The starting index of the section to reverse. The number of elements in the section to reverse. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  The current instance has more than one dimension.

  is outside the range of valid indices for the current instance.

  is not assignment-compatible with the element type of the current instance.

  The and methods can determine whether the value of is out of bounds.

  For more information about conversions, see .

  This method is an O(1) operation.

  If is used to assign null to an element of an array of value types, all fields of the element are initialized to zero. The value of the element is not a null reference, and cannot be found by searching for a null reference.

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

  The new value for the specified element. A 32-bit integer that represents the position of the element to set. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `System.ParamArray` is .

  The number of dimensions in the current instance is not equal to the number of elements in .

  At least one element in is outside the range of valid indices for the corresponding dimension of the current instance.

  is not assignment-compatible with the element type of the current instance.

  The number of elements in must equal the number of dimensions in the . All elements in the array must collectively specify the position of the desired element in the multidimensional .

  The and methods can determine whether any of the values in the array is out of bounds.

  For more information about conversions, see .

  This method is an O(1) operation.

  If is used to assign null to an element of an array of value types, all fields of the element are initialized to zero. The value of the element is not a null reference, and cannot be found by searching for a null reference.

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

  The new value for the specified element. A one-dimensional array of 32-bit integers that represent the indexes specifying the position of the element to set. 1 ExtendedArray
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void `` ``

  The and methods can determine whether the value of is out of bounds.

  For more information about conversions, see .

  This method is an O(1) operation.

  If is used to assign null to an element of an array of value types, all fields of the element are initialized to zero. The value of the element is not a null reference, and cannot be found by searching for a null reference.

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

  The new value for the specified element. A 64-bit integer that represents the position of the element to set.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void `` `System.ParamArray`

  The number of elements in must equal the number of dimensions in the . All elements in the array must collectively specify the position of the desired element in the multidimensional .

  The and methods can determine whether any of the values in the array is out of bounds.

  For more information about conversions, see .

  This method is an O(1) operation.

  If is used to assign null to an element of an array of value types, all fields of the element are initialized to zero. The value of the element is not a null reference, and cannot be found by searching for a null reference.

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

  The new value for the specified element. A one-dimensional array of 64-bit integers that represent the indexes specifying the position of the element to set.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` ``

  The current instance does not have exactly two dimensions.

  At least one of or is outside the range of valid indices for the corresponding dimension of the current instance.

  is not assignment-compatible with the element type of the current instance.

  The and methods can determine whether any of the indexes is out of bounds.

  For more information about conversions, see .

  This method is an O(1) operation.

  If is used to assign null to an element of an array of value types, all fields of the element are initialized to zero. The value of the element is not a null reference, and cannot be found by searching for a null reference.

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

  The new value for the specified element. A 32-bit integer that represents the first-dimension index of the element to set. A 32-bit integer that represents the second-dimension index of the element to set. 1 ExtendedArray
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void `` `` ``

  The and methods can determine whether any of the indexes is out of bounds.

  For more information about conversions, see .

  This method is an O(1) operation.

  If is used to assign null to an element of an array of value types, all fields of the element are initialized to zero. The value of the element is not a null reference, and cannot be found by searching for a null reference.

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

  The new value for the specified element. A 64-bit integer that represents the first-dimension index of the element to set. A 64-bit integer that represents the second-dimension index of the element to set.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` ``

  The current instance does not have exactly three dimensions.

  At least one of , , or is outside the range of valid indices for the corresponding dimension of the current instance.

  is not assignment-compatible with the element type of the current instance.

  The and methods can determine whether any of the indexes is out of bounds.

  For more information about conversions, see .

  This method is an O(1) operation.

  If is used to assign null to an element of an array of value types, all fields of the element are initialized to zero. The value of the element is not a null reference, and cannot be found by searching for a null reference.

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

  The new value for the specified element. A 32-bit integer that represents the first-dimension index of the element to set. A 32-bit integer that represents the second-dimension index of the element to set. A 32-bit integer that represents the third-dimension index of the element to set. 1 ExtendedArray
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void `` `` `` ``

  The and methods can determine whether any of the indexes is out of bounds.

  For more information about conversions, see .

  This method is an O(1) operation.

  If is used to assign null to an element of an array of value types, all fields of the element are initialized to zero. The value of the element is not a null reference, and cannot be found by searching for a null reference.

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

  The new value for the specified element. A 64-bit integer that represents the first-dimension index of the element to set. A 64-bit integer that represents the second-dimension index of the element to set. A 64-bit integer that represents the third-dimension index of the element to set.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` is . has more than one dimension. One or more elements in do not implement the interface.

  This example demonstrates the method.

  `using System; public class ArraySortExample { public static void Main() { string[] strAry = { "All's", "well", "that", "ends", "well" }; Console.Write( "The original string array is: " ); foreach ( String str in strAry ) Console.Write( str + " " ); Console.WriteLine(); Array.Sort( strAry ); Console.Write( "The sorted string array is: " ); foreach ( string str in strAry ) Console.Write( str + " " ); } }`

  The output is

  The original string array is: All's well that ends well

  The sorted string array is: All's ends that well well

  One or more elements in that are used in a comparison do not implement the interface.

  Each element of must implement the interface to be capable of comparisons with every other element in .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is the of .

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

  The one-dimensional to sort. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` ``

  is .

  has more than one dimension.

  -or-

  is not a null reference and has more than one dimension.

  is not a null reference, and .GetLowerBound(0) does not equal .GetLowerBound(0).

  -or-

  is not a null reference, and .Length > .Length.

  This example demonstrates the method.

  `using System; public class ArraySortExample { public static void Main() { string[] strAry = { "All's", "well", "that", "ends", "well" }; int[] intAry = { 3, 4, 0, 1, 2 }; Console.Write( "The original string array is: " ); foreach ( string str in strAry ) Console.Write( str + " " ); Console.WriteLine(); Console.Write( "The key array is: " ); foreach ( int i in intAry ) Console.Write( i + " " ); Console.WriteLine(); Array.Sort( intAry, strAry ); Console.Write( "The sorted string array is: " ); foreach ( string str in strAry ) Console.Write( str + " " ); } }`

  The output is

  The original string array is: All's well that ends well

  The key array is: 3 4 0 1 2

  The sorted string array is: that ends well All's well

  One or more elements in that are used in a comparison do not implement the interface.

  Each key in the has a corresponding item in the . When a key is repositioned during the sorting, the corresponding item in the is similarly repositioned. Therefore, the is sorted according to the arrangement of the corresponding keys in the .

  Each key in the must implement the interface to be capable of comparisons with every other key.

  You can sort if there are more items than keys, but the items that have no corresponding keys will not be sorted. You cannot sort if there are more keys than items; doing this throws an .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is the of .

  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.

  The one-dimensional that contains the keys to sort. The one-dimensional that contains the items that correspond to each of the keys in the . 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` is . has more than one dimension. is a null reference, and one or more elements in do not implement the interface. is a null reference, and one or more elements in that are used in a comparison do not implement the interface.

  If is null, each element of must implement the interface to be capable of comparisons with every other element in .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is the of .

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

  The one-dimensional to sort. The implementation to use when comparing elements. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` ``

  is .

  has more than one dimension.

  -or-

  is not a null reference and has more than one dimension.

  is not a null reference, and .GetLowerBound(0) does not equal .GetLowerBound(0).

  -or-

  is not a null reference, and .Length > .Length.

  is a , and one or more elements in that are used in a comparison do not implement the interface.

  Each key in the has a corresponding item in the . When a key is repositioned during the sorting, the corresponding item in the is similarly repositioned. Therefore, the is sorted according to the arrangement of the corresponding keys in the .

  If is null, each key in the must implement the interface to be capable of comparisons with every other key.

  You can sort if there are more items than keys, but the items that have no corresponding keys will not be sorted. You cannot sort if there are more keys than items; doing this throws an .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is the of .

  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 .

  The one-dimensional that contains the keys to sort. The one-dimensional that contains the items that correspond to each of the keys in the . The implementation to use when comparing elements. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` `` is . has more than one dimension.

  < .GetLowerBound(0).

  -or-

  < 0.

  and do not specify a valid range in .

  One or more elements in that are used in a comparison do not implement the interface.

  Each element within the specified range of elements in must implement the interface to be capable of comparisons with every other element in .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is .

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

  The one-dimensional to sort. The starting index of the range to sort. The number of elements in the range to sort. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` `` ``

  is .

  has more than one dimension.

  -or-

  is not a null reference and has more than one dimension.

  < .GetLowerBound(0).

  -or-

  < 0.

  is not a null reference, and .GetLowerBound(0) does not equal .GetLowerBound(0).

  -or-

  and do not specify a valid range in .

  -or-

  is not a null reference, and and do not specify a valid range in .

  One or more elements in that are used in a comparison do not implement the interface.

  Each key in the has a corresponding item in the . When a key is repositioned during the sorting, the corresponding item in the is similarly repositioned. Therefore, the is sorted according to the arrangement of the corresponding keys in the .

  Each key within the specified range of elements in the must implement the interface to be capable of comparisons with every other key.

  You can sort if there are more items than keys, but the items that have no corresponding keys will not be sorted. You cannot sort if there are more keys than items; doing this throws an .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is .

  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.

  The one-dimensional that contains the keys to sort. The one-dimensional that contains the items that correspond to each of the keys in the . The starting index of the range to sort. The number of elements in the range to sort. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` `` `` is . has more than one dimension.

  < .GetLowerBound(0).

  -or-

  < 0.

  and do not specify a valid range in .

  is , and one or more elements in that are used in a comparison do not implement the interface.

  If is null, each element within the specified range of elements in must implement the interface to be capable of comparisons with every other element in .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is .

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

  The one-dimensional to sort. The starting index of the range to sort. The number of elements in the range to sort. The implementation to use when comparing elements. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` `` `` ``

  is .

  has more than one dimension.

  -or-

  is not a null reference and has more than one dimension.

  < .GetLowerBound(0).

  -or-

  < 0.

  is not a null reference, and .GetLowerBound(0) does not equal .GetLowerBound(0).

  -or-

  and do not specify a valid range in .

  -or-

  is not a null reference, and and do not specify a valid range in .

  is , and one or more elements in that are used in a comparison do not implement the interface.

  Each key in the has a corresponding item in the . When a key is repositioned during the sorting, the corresponding item in the is similarly repositioned. Therefore, the is sorted according to the arrangement of the corresponding keys in the .

  If is null, each key within the specified range of elements in the must implement the interface to be capable of comparisons with every other key.

  You can sort if there are more items than keys, but the items that have no corresponding keys will not be sorted. You cannot sort if there are more keys than items; doing this throws an .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is .

  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 .

  The one-dimensional that contains the keys to sort. The one-dimensional that contains the items that correspond to each of the keys in the . The starting index of the range to sort. The number of elements in the range to sort. The implementation to use when comparing elements. 0
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` To be added.

  The array to sort.

  Sorts the elements in an entire array using the or implementation of each element of that array.

  Each element of is required to implement the or interface to be capable of comparisons with every other element in .

  If the sort is not successfully completed, the results are undefined.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  is .

  One or more elements in that are used in a comparison are the null reference or do not implement the or interface.

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` ``

  is .

  is , and one or more elements in that are used in a comparison do not implement the or interface.

  If is null, each element of must implement the generic interface to be capable of comparisons with every other element in .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is the of .

  Sorts the elements in an using the specified generic interface.

  The one-dimensional, zero-base to sort The generic interface implementation to use when comparing elements, or null to use the generic interface implementation of each element. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  is .

  -or-

  is .

  If the sort is not successfully completed, the results are undefined.

  This method uses introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is the of .

  Sorts the elements in an using the specified .

  The one-dimensional, zero-based to sort The to use when comparing elements. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` `` To be added.

  The array to sort.

  The starting index of the range to sort. The number of elements in the range to sort.

  Sorts an array using the or implementation of each element of that array.

  Each element within the specified range of elements in must implement the or interface to be capable of comparisons with every other element in .

  If the sort is not successfully completed, the results are undefined.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  and do not specify a valid range in .

  is .

  is less than zero.

  -or-

  is less than zero.

  One or more elements in that are used in a comparison do not implement the or interface.

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` `` ``

  is .

  is less than zero.

  -or-

  is less than zero.

  and do not specify a valid range in .

  is , and one or more elements in that are used in a comparison do not implement the or interface.

  If is null, each element within the specified range of elements in must implement the generic interface to be capable of comparisons with every other element in .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is .

  Sorts the elements in a range of elements in an using the specified generic interface.

  The one-dimensional, zero-based to sort. The starting index of the range to sort. The number of elements in the range to sort. The generic interface implementation to use when comparing elements, or null to use the generic interface implementation of each element. The type of the elements of the array.
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` To be added. To be added.

  The array that contains the keys to sort.

  The array that contains the items that correspond to each of the keys in .

  -or-

  to sort only the array.

  Sorts a pair of arrays based on the keys in the first array using the implementation of each key.

  If is non-null, each key in is required to have a corresponding item in . When a key is repositioned during the sorting, the corresponding item in is similarly repositioned. Therefore, is sorted according to the arrangement of the corresponding keys in .

  Each key in must implement the or interface to be capable of comparisons with every other key.

  If the sort is not successfully completed, the results are undefined.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  is not , and the length of does not equal the length of .

  is .

  One or more elements in that are used in a comparison are the null reference or do not implement the or interface.

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` ``

  is .

  is not , and the length of does not match the length of .

  is , and one or more elements in that are used in a comparison do not implement the or interface.

  Each key in the has a corresponding item in the . When a key is repositioned during the sorting, the corresponding item in the is similarly repositioned. Therefore, the is sorted according to the arrangement of the corresponding keys in the .

  If is null, each key in the must implement the generic interface to be capable of comparisons with every other key.

  You can sort if there are more items than keys, but the items that have no corresponding keys will not be sorted. You cannot sort if there are more keys than items; doing this throws an .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is the of .

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

  The one-dimensional, zero-based that contains the keys to sort. The one-dimensional, zero-based that contains the items that correspond to the keys in , or null to sort only . The generic interface implementation to use when comparing elements, or null to use the generic interface implementation of each element. The type of the elements of the key array. The type of the elements of the items array.
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` `` `` To be added. To be added.

  The array that contains the keys to sort.

  The array that contains the items that correspond to each of the keys in .

  -or-

  to sort only the array.

  The starting index of the range to sort. The number of elements in the range to sort.

  Sorts a range of elements in a pair of arrays based on the keys in the first array, using the or implementation of each key.

  If is non-null, each key in is required to have a corresponding item in . When a key is repositioned during the sorting, the corresponding item in is similarly repositioned. Therefore, is sorted according to the arrangement of the corresponding keys in .

  If the sort is not successfully completed, the results are unspecified.

  Each key within the specified range of elements in must implement the or interface to be capable of comparisons with every other key.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  and do not specify a valid range in .

  -or-

  is not , and and do not specify a valid range in .

  is .

  is less than zero.

  -or-

  is less than zero.

  One or more elements in that are used in a comparison are the null reference or do not implement the or interface.

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void `` `` `` `` ``

  and do not specify a valid range in .

  -or-

  is not , and and do not specify a valid range in .

  is .

  is less than zero.

  -or-

  is less than zero.

  is , and one or more elements in that are used in a comparison do not implement the or interface.

  Each key in the has a corresponding item in the . When a key is repositioned during the sorting, the corresponding item in the is similarly repositioned. Therefore, the is sorted according to the arrangement of the corresponding keys in the .

  If is null, each key within the specified range of elements in the must implement the generic interface to be capable of comparisons with every other key.

  You can sort if there are more items than keys, but the items that have no corresponding keys will not be sorted. You cannot sort if there are more keys than items; doing this throws an .

  If the sort is not successfully completed, the results are undefined.

  This method uses the introspective sort (introsort) algorithm as follows:

  If the partition size is fewer than 16 elements, it uses an insertion sort algorithm.

  If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm.

  Otherwise, it uses a Quicksort algorithm.

  This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

  For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O( log ) operation, where is .

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

  The one-dimensional, zero-based that contains the keys to sort. The one-dimensional, zero-based that contains the items that correspond to the keys in , or null to sort only . The starting index of the range to sort. The number of elements in the range to sort. The generic interface implementation to use when comparing elements, or null to use the generic interface implementation of each element. The type of the elements of the key array. The type of the elements of the items array.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object To be added.

  This property implements the interface.

  .NET Framework classes based on provide their own synchronized version of the collection using the property.

  Classes that use arrays can also implement their own synchronization using the property. The synchronizing code must perform operations on the SyncRoot of the collection, not directly on the collection. This ensures proper operation of collections that are derived from other objects. Specifically, it maintains proper synchronization with other threads that might be simultaneously modifying the collection. Note that some implementations of might return the itself.

  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.

  Retrieving the value of this property is an O(1) operation.

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

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 To be added.

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an T:System.Collections.ICollection interface.

  Gets the number of elements contained in the .

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Adds an item to .

  The position into which the new element was inserted, or -1 to indicate that the item was not inserted into the collection.

  The object to be added to the .
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Removes all items from the .

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Determines whether an element is in the .

  true if is found in the ; otherwise, false.

  The object to locate in the current list. The element to locate can be null for reference types.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int32 ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Determines the index of a specific item in the .

  The index of value if found in the list; otherwise, -1.

  The object to locate in the current list.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Inserts an item to the at the specified index.

  The index at which should be inserted. The object to insert.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object `` To be added. Implemented to support the interface. [Note: For more information, see .] To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Removes the first occurrence of a specific object from the .

  The object to remove from the .
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Removes the item at the specified index.

  The index of the element to remove.
- Method
  4.0.0.0
  System.Int32 `` ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Determines whether the current collection object precedes, occurs in the same position as, or follows another object in the sort order.

  An integer that indicates the relationship of the current collection object to other, as shown in the following table.

  Return value

  Description

  -1

  The current instance precedes .

  0

  The current instance and are equal.

  1

  The current instance follows .

  The object to compare with the current instance. An object that compares the current object and .
- Method
  4.0.0.0
  System.Boolean `` ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Determines whether an object is equal to the current instance.

  true if the two objects are equal; otherwise, false.

  The object to compare with the current instance. An object that determines whether the current instance and are equal.
- Method
  4.0.0.0
  System.Int32 ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Returns a hash code for the current instance.

  The hash code for the current instance.

  An object that computes the hash code of the current object.
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean `` `` or is .

  The is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate. The elements of are individually passed to the , and processing is stopped when the delegate returns false for any element.

  This method is an O() operation, where is the of .

  Determines whether every element in the array matches the conditions defined by the specified predicate.

  true if every element in matches the conditions defined by the specified predicate; otherwise, false. If there are no elements in the array, the return value is true.

  The one-dimensional, zero-based to check against the conditions. The predicate that defines the conditions to check against the elements. The type of the elements of the array.
0