ContextNodeBaseCollection.CopyTo 方法

从指定的目标数组索引处开始,将当前 ContextNodeBaseCollection 的所有元素复制到指定的一维数组中。

命名空间:  System.Windows.Ink.AnalysisCore
程序集:  IACore(在 IACore.dll 中)

语法

声明
Public Sub CopyTo ( _
    array As ContextNodeBase(), _
    index As Integer _
)
用法
Dim instance As ContextNodeBaseCollection
Dim array As ContextNodeBase()
Dim index As Integer

instance.CopyTo(array, index)
public void CopyTo(
    ContextNodeBase[] array,
    int index
)
public:
void CopyTo(
    array<ContextNodeBase^>^ array, 
    int index
)
public void CopyTo(
    ContextNodeBase[] array,
    int index
)
public function CopyTo(
    array : ContextNodeBase[], 
    index : int
)

参数

  • index
    类型:System.Int32
    array 参数中从零开始的索引,将从该索引处开始复制。

备注

这些元素将复制到 Array,复制顺序与枚举数循环访问 ContextNodeBaseCollection 的顺序相同。

在下列情况下会引发异常:

  • array 参数为 nullnull 引用(在 Visual Basic 中为 Nothing) 引用。

  • index 参数小于零。

  • array 参数是多维的。

  • index 参数等于或大于 array 参数的长度。

  • 集合中元素的数目大于从 index 参数到目标 array 参数末尾之间的可用空间。

集合类型将自动强制转换为目标 array 参数的类型。但是,此方法仅将元素复制到与集合中的元素类型相同的数组中,或者复制到 Object 类型的数组中。尝试复制到其他类型的数组将导致引发 InvalidCastException

此方法是同步的。

示例

下面的示例使用名为 theInkAnalyzerBase 的 InkAnalyzerBase 能够找到的所有段落填充 ContextNodeBase 对象数组的一部分。填充从名为 paragraphArray 的目标数组的元素 1(从零开始的数组中的第二个元素)开始,并将目标数组的第一个元素(索引为 0)留空。

Dim paragraphs As ContextNodeBaseCollection = _
    theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph)
Dim paragraphArray(paragraphs.Count) As ContextNodeBase
paragraphs.CopyTo(paragraphArray, 1)
            ContextNodeBaseCollection paragraphs =
                theInkAnalyzer.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph);
            ContextNodeBase[] paragraphArray = new ContextNodeBase[paragraphs.Count + 1];
            paragraphs.CopyTo(paragraphArray, 1);

平台

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

ContextNodeBaseCollection 类

ContextNodeBaseCollection 成员

System.Windows.Ink.AnalysisCore 命名空间