ArrayList.ToArray Method (Type)
.NET Framework (current version)
Copies the elements of the ArrayList to a new array of the specified element type.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- type
-
Type:
System.Type
The element Type of the destination array to create and copy elements to.
Return Value
Type: System.ArrayAn array of the specified element type containing copies of the elements of the ArrayList.
| Exception | Condition |
|---|---|
| ArgumentNullException | type is null. |
| InvalidCastException | The type of the source ArrayList cannot be cast automatically to the specified type. |
All of the objects in the ArrayList object will be cast to the Type specified in the type parameter.
The elements are copied using Array.Copy, which is an O(n) operation, where n is Count.
Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Available since 10
.NET Framework
Available since 1.1
Show: