Mono Class Library: System.Collections.Hashtable Overview | Members

System.Collections.Hashtable.CopyTo Method

Copies the entries of the current instance to a one-dimensional Array starting at the specified index. [Edit]

public virtual void CopyTo (Array array, int arrayIndex)

Parameters

array
The one-dimensional, zero-indexed Array that is the destination of the objects copied from the current instance. [Edit]
arrayIndex
A int that specifies the zero-based index in array at which copying begins. This value is between 0 and array.Length minus the Hashtable.Count of the current instance, inclusive. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionarray is null. [Edit]
ArgumentOutOfRangeExceptionarrayIndex < 0. [Edit]
ArgumentException

array has more than one dimension.

-or-

arrayIndex > array.Length - The Hashtable.Count of the current instance.

[Edit]
InvalidCastExceptionThe type of the current instance is not assignment-compatible with the type of array. [Edit]

Remarks

Operation
As described above.

The DictionaryEntry elements in the current instance are copied to the Array in the same order in which they are contained the current instance. If DictionaryEntry is not assignment-compatible with the type of array, a InvalidCastException is thrown. If an exception is thrown while copying, the state of the current instance is undefined.

[Edit]

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0