DirectoryAttributeCollection.CopyTo(DirectoryAttribute[], Int32) 方法
定义
CopyTo(DirectoryAttribute[], Int32) 方法将整个集合复制到一维数组中(从目标数组的指定索引处开始)。The CopyTo(DirectoryAttribute[], Int32) method copies the entire collection to a one-dimensional array, starting at the specified index of the target array.
public:
void CopyTo(cli::array <System::DirectoryServices::Protocols::DirectoryAttribute ^> ^ array, int index);
public void CopyTo (System.DirectoryServices.Protocols.DirectoryAttribute[] array, int index);
member this.CopyTo : System.DirectoryServices.Protocols.DirectoryAttribute[] * int -> unit
Public Sub CopyTo (array As DirectoryAttribute(), index As Integer)
参数
- array
- DirectoryAttribute[]
一个一维数组,它是从 DirectoryAttributeCollection 对象复制的元素的目标。A one-dimensional array that is the destination of the elements copied from the DirectoryAttributeCollection object.
- index
- Int32
array 中从零开始的索引,这是开始复制的位置。The zero-based index of array where copying begins.
注解
异常Exceptions
| 例外Exception | 条件Condition |
|---|---|
| ArgumentNullExceptionArgumentNullException | array 为空引用(在 Visual Basic 中为 Nothing)。array is a null reference (Nothing in Visual Basic). |
| ArgumentOutOfRangeExceptionArgumentOutOfRangeException | index 小于零。index is less than zero. |
| ArgumentExceptionArgumentException | array 是多维的。array is multidimensional.- 或 --or- 源 DirectoryAttributeCollection 中的元素个数大于从 index 到目标 array 末尾之间的可用空间。The number of elements in the source DirectoryAttributeCollection is greater than the available space from index to the end of the destination array. |
| InvalidCastExceptionInvalidCastException | 无法自动将源 DirectoryAttributeCollection 的类型转换为目标 array 的类型。The type of the source DirectoryAttributeCollection cannot be cast automatically to the type of the destination array. |