DataGridViewSelectedColumnCollection.CopyTo(DataGridViewColumn[], Int32) 方法

定义

从指定索引处开始,将集合中的元素复制到指定的数组。Copies the elements of the collection to the specified array, starting at the specified index.

public:
 void CopyTo(cli::array <System::Windows::Forms::DataGridViewColumn ^> ^ array, int index);
public void CopyTo (System.Windows.Forms.DataGridViewColumn[] array, int index);
override this.CopyTo : System.Windows.Forms.DataGridViewColumn[] * int -> unit
Public Sub CopyTo (array As DataGridViewColumn(), index As Integer)

参数

array
DataGridViewColumn[]

作为集合中元素的复制目标位置的一维数组。The one-dimensional array that is the destination of the elements copied from the collection. 该数组的索引必须从零开始。The array must have zero-based indexing.

index
Int32

数组中开始复制的位置的索引(从零开始)。The zero-based index in the array at which copying begins.

异常

arraynullarray is null.

index 小于零。index is less than zero.

array 是多维的。array is multidimensional.

-or- DataGridViewCellCollection 中的元素个数大于 indexarray 末尾之间的可用空间。The number of elements in the DataGridViewCellCollection is greater than the available space from index to the end of array.

DataGridViewColumnCollection 无法自动强制转换为 array 类型。The DataGridViewColumnCollection cannot be cast automatically to the type of array.

适用于

另请参阅