SortedList<TKey, TValue>.ICollection<KeyValuePair<TKey, TValue>>.CopyTo Method

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

Namespace:  System.Collections.Generic
Assemblies:   System (in System.dll)
  System.Collections (in System.Collections.dll)

void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(
	KeyValuePair<TKey, TValue>[] array,
	int arrayIndex
)

Parameters

array
Type: System.Collections.Generic.KeyValuePair<TKey, TValue>[]

The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.

arrayIndex
Type: System.Int32

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

Implements

ICollection<T>.CopyTo(T[], Int32)

ExceptionCondition
ArgumentNullException

array is null.

ArgumentOutOfRangeException

arrayIndex is less than zero.

ArgumentException

The number of elements in the source ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.

This method determines equality using the default comparer Comparer<T>.Default for System.Collections.Generic.KeyValuePair<TKey, TValue>.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft