Dictionary<TKey,TValue>.ICollection.CopyTo(Array, Int32) Yöntem
Tanım
Öğesinin öğelerini ICollection<T> belirtilen dizi dizininden başlayarak bir diziye kopyalar.Copies the elements of the ICollection<T> to an array, starting at the specified array index.
virtual void System.Collections.ICollection.CopyTo(Array ^ array, int index) = System::Collections::ICollection::CopyTo;
void ICollection.CopyTo (Array array, int index);
abstract member System.Collections.ICollection.CopyTo : Array * int -> unit
override this.System.Collections.ICollection.CopyTo : Array * int -> unit
Sub CopyTo (array As Array, index As Integer) Implements ICollection.CopyTo
Parametreler
- array
- Array
Öğesinden kopyalanmış öğelerin hedefi olan tek boyutlu dizi ICollection<T> .The one-dimensional array that is the destination of the elements copied from ICollection<T>. Dizinin sıfır tabanlı dizinlemeye sahip olması gerekir.The array must have zero-based indexing.
- index
- Int32
array
içinde kopyalamanın başladığı sıfır tabanlı dizin.The zero-based index in array
at which copying begins.
Uygulamalar
Özel durumlar
array
, null
değeridir.array
is null
.
index
0 ' dan küçük.index
is less than 0.
array
çok boyutludur.array
is multidimensional.
-veya--or-
array
sıfır tabanlı dizine sahip değil.array
does not have zero-based indexing.
-veya--or-
Kaynaktaki öğe sayısı, ICollection<T> hedefin sonuna kadar olan kullanılabilir alandan daha büyük index
array
.The number of elements in the source ICollection<T> is greater than the available space from index
to the end of the destination array
.
-veya--or-
Kaynak türü, ICollection<T> hedefin türüne otomatik olarak atanamaz array
.The type of the source ICollection<T> cannot be cast automatically to the type of the destination array
.
Açıklamalar
Bir öğesinden kopyalanmış her öğe Dictionary<TKey,TValue> , bir KeyValuePair<TKey,TValue> değeri ve anahtarını temsil eden bir yapıdır.Each element copied from a Dictionary<TKey,TValue> is a KeyValuePair<TKey,TValue> structure representing a value and its key.
Not
Kaynak türü ICollection hedef türüne otomatik olarak yayınlanamaz, genel array
ICollection.CopyTo InvalidCastException uygulamalar bir oluşturur, ancak genel uygulamalar bir oluşturur ArgumentException .If the type of the source ICollection cannot be cast automatically to the type of the destination array
, the nongeneric implementations of ICollection.CopyTo throw an InvalidCastException, whereas the generic implementations throw an ArgumentException.
Bu yöntem, olduğu bir O ( n
) işlemidir n
Count .This method is an O(n
) operation, where n
is Count.