Επεξεργασία

Κοινή χρήση μέσω


SortedDictionary<TKey,TValue>.KeyCollection.CopyTo Method

Definition

Copies the SortedDictionary<TKey,TValue>.KeyCollection elements to an existing one-dimensional array, starting at the specified array index.

public:
 virtual void CopyTo(cli::array <TKey> ^ array, int index);
public void CopyTo (TKey[] array, int index);
abstract member CopyTo : 'Key[] * int -> unit
override this.CopyTo : 'Key[] * int -> unit
Public Sub CopyTo (array As TKey(), index As Integer)

Parameters

array
TKey[]

The one-dimensional array that is the destination of the elements copied from the SortedDictionary<TKey,TValue>.KeyCollection. The array must have zero-based indexing.

index
Int32

The zero-based index in array at which copying begins.

Implements

Exceptions

array is null.

index is less than 0.

The number of elements in the source SortedDictionary<TKey,TValue>.KeyCollection is greater than the available space from index to the end of the destination array.

Remarks

The elements are copied to the array in the same order in which the enumerator iterates through the SortedDictionary<TKey,TValue>.KeyCollection.

This method is an O(n) operation, where n is Count.

Applies to

See also