asp.net.ph

Array.Clear Method

System Namespace   Array Class


Sets a range of elements in the Array to zero, to false, or to a null reference ( Nothing in Visual Basic ) , depending on the element type.

[ VB ]
<Serializable>
Public Shared Sub Clear ( _
   ByVal array As Array, _
   ByVal index As Integer, _
   ByVal length As Integer _
)

[ C# ]
[Serializable]
public static void Clear (
   Array array,
   int index,
   int length
);

[ C++ ]
[Serializable]
public: static void Clear (
   Array* array,
   int index,
   int length
);

[JScript ]
public Serializable
static function Clear (
   array : Array,
   index : int,
   length : int
);

Parameters

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

Exceptions


Exception Type Condition
ArgumentNullException array is a null reference ( Nothing in Visual Basic ).
ArgumentOutOfRangeException index is less than zero.

-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 a null reference ( Nothing in Visual Basic ). Boolean-type elements are set to false. Other value-type elements are set to zero.

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.

See Also

Array Members   ICollection.Count Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph