SortedDictionary<TKey,TValue>.CopyTo Metoda

Definice

Zkopíruje prvky zadaného SortedDictionary<TKey,TValue> pole KeyValuePair<TKey,TValue> struktur počínaje zadaným indexem.

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

Parametry

array
KeyValuePair<TKey,TValue>[]

Jednorozměrné pole KeyValuePair<TKey,TValue> struktur, které je cílem prvků zkopírovaných z aktuálního SortedDictionary<TKey,TValue> pole, musí mít indexování založené na nule.

index
Int32

Index založený na nule, ve array kterém začíná kopírování.

Implementuje

Výjimky

array je null.

index je menší než 0.

Počet prvků ve zdroji SortedDictionary<TKey,TValue> je větší než dostupné místo od index konce cíle array.

Poznámky

Note

Pokud typ zdroje SortedDictionary<TKey,TValue> nelze automaticky přetypovat na typ cíle array, negenerické implementace ICollection.CopyTo throw InvalidCastException, zatímco obecné implementace vyvolá ArgumentException.

Tato metoda je operace O(n), kde n je Count.

Platí pro