SortedDictionary<TKey,TValue>.ValueCollection.CopyTo(TValue[], Int32) 方法

定义

从指定的数组索引开始,将 SortedDictionary<TKey,TValue>.ValueCollection 元素复制到现有的一维数组中。Copies the SortedDictionary<TKey,TValue>.ValueCollection elements to an existing one-dimensional array, starting at the specified array index.

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

参数

array
TValue[]

一维数组,它是从 SortedDictionary<TKey,TValue>.ValueCollection 中复制的元素的目标。The one-dimensional array that is the destination of the elements copied from the SortedDictionary<TKey,TValue>.ValueCollection. 该数组的索引必须从零开始。The array must have zero-based indexing.

index
Int32

array 中从零开始的索引,从此处开始复制。The zero-based index in array at which copying begins.

异常

arraynullarray is null.

index 小于 0。index is less than 0.

SortedDictionary<TKey,TValue>.ValueCollection 中的元素个数大于从 index 到目标 array 末尾之间的可用空间。The number of elements in the source SortedDictionary<TKey,TValue>.ValueCollection is greater than the available space from index to the end of the destination array.

注解

元素将按照枚举器循环访问 SortedDictionary<TKey,TValue>.ValueCollection 的相同顺序复制到数组。The elements are copied to the array in the same order in which the enumerator iterates through the SortedDictionary<TKey,TValue>.ValueCollection.

此方法的运算复杂度为 O (n),其中 n CountThis method is an O(n) operation, where n is Count.

适用于

另请参阅