Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Sets a range of elements in the Array to zero, to false, or to nullNothingnullptrunita null reference (Nothing in Visual Basic), depending on the element type.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Shared Sub Clear ( _
array As Array, _
index As Integer, _
length As Integer _
)
public static void Clear(
Array array,
int index,
int length
)
public:
static void Clear(
Array^ array,
int index,
int length
)
static member Clear :
array:Array *
index:int *
length:int -> unit
public static function Clear(
array : Array,
index : int,
length : int
)
Parameters
- array
Type: System. . :: . .Array
The Array whose elements need to be cleared.
- index
Type: System. . :: . .Int32
The starting index of the range of elements to clear.
- length
Type: System. . :: . .Int32
The number of elements to clear.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | array is null Nothing nullptr unit a null reference (Nothing in Visual Basic) . |
IndexOutOfRangeException | index is less than the lower bound of array. -or- length is less than zero. -or- The sum of index and length is greater than the size of the Array. |
Remarks
Reference-type elements are set to null Nothing nullptr unit a null reference (Nothing in Visual Basic) . Boolean-type elements are set to false. Other value-type elements are set to zero.
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.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.