Type Reason ArgumentNullException array is null. ArgumentOutOfRangeException index < array.GetLowerBound(0).
length < 0.
index and length do not specify a valid range in array (i.e. index + length > array.GetLowerBound(0) + array.Length ).
This method resets each element in an array to the element type's default value. It sets elements of reference types (including string elements) to null, and sets elements of value types to the default values shown in the following table.
bool |
false |
All integral and floating point numeric types |
0 (zero) |
DateTime | |
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(n) operation, where n is length.