DictionaryBase.CopyTo 方法
将 DictionaryBase 元素复制到位于指定索引处的一维 Array 中。
**命名空间:**System.Collections
**程序集:**mscorlib(在 mscorlib.dll 中)
语法
声明
Public Sub CopyTo ( _
array As Array, _
index As Integer _
)
用法
Dim instance As DictionaryBase
Dim array As Array
Dim index As Integer
instance.CopyTo(array, index)
public void CopyTo (
Array array,
int index
)
public:
virtual void CopyTo (
Array^ array,
int index
) sealed
public final void CopyTo (
Array array,
int index
)
public final function CopyTo (
array : Array,
index : int
)
参数
- array
一维 Array,为从 DictionaryBase 实例复制的 DictionaryEntry 对象的目标位置。Array 必须具有从零开始的索引。
- index
array 中从零开始的索引,在此处开始复制。
异常
异常类型 | 条件 |
---|---|
array 为 空引用(在 Visual Basic 中为 Nothing)。 |
|
index 小于零。 |
|
array 是多维的。 - 或 - index 等于或大于 array 的长度。 - 或 - 源 DictionaryBase 中的元素数目大于从 index 到目标 array 末尾之间的可用空间。 |
|
源 DictionaryBase 的类型无法自动转换为目标 array 的类型。 |
备注
元素按照枚举数循环访问 DictionaryBase 的顺序复制到 Array 中。
此方法的运算复杂度为 O(n),其中 n 是 Count。
平台
Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
请参见
参考
DictionaryBase 类
DictionaryBase 成员
System.Collections 命名空间
Array 类
DictionaryEntry
GetEnumerator