Evidence.CopyTo(Array, Int32) Evidence.CopyTo(Array, Int32) Evidence.CopyTo(Array, Int32) Method

定義

警告

この API は現在使われていません。

Array に証拠オブジェクトをコピーします。Copies evidence objects to an Array.

public:
 virtual void CopyTo(Array ^ array, int index);
[System.Obsolete]
[System.Obsolete("Evidence should not be treated as an ICollection. Please use the GetHostEnumerator and GetAssemblyEnumerator methods rather than using CopyTo.")]
public void CopyTo (Array array, int index);
abstract member CopyTo : Array * int -> unit
override this.CopyTo : Array * int -> unit

パラメーター

array
Array Array Array

証拠オブジェクトのコピー先の配列。The target array to which to copy evidence objects.

index
Int32 Int32 Int32

証拠オブジェクトのコピー開始位置を示す、配列内の 0 から始まるインデックス位置。The zero-based position in the array to which to begin copying evidence objects.

実装

例外

array が null です。array is null.

index は、対象となる配列の範囲外です。index is outside the range of the target array.

次のコード例の使用を示しています、CopyToメソッド。The following code example shows the use of the CopyTo method. この例が示されている例の一部、Evidenceクラス。This example is part of a larger example provided for the Evidence class.

Console::WriteLine( "\nCopy the evidence to an array using CopyTo, then display the array." );
array<Object^>^evidenceArray = gcnew array<Object^>(myEvidence->Count);
myEvidence->CopyTo( evidenceArray, 0 );
for each (Object^ obj in evidenceArray)
{
   Console::WriteLine(obj->ToString());
}
Console.WriteLine("\nCopy the evidence to an array using CopyTo, then display the array.");
object[] evidenceArray = new object[myEvidence.Count];
myEvidence.CopyTo(evidenceArray, 0);
foreach (object obj in evidenceArray)
{
    Console.WriteLine(obj.ToString());
}
Console.WriteLine(ControlChars.Lf & "Copy the evidence to an array using CopyTo, then display the array.")
Dim evidenceArray(myEvidence.Count - 1) As Object
myEvidence.CopyTo(evidenceArray, 0)
Dim obj As Object
For Each obj In evidenceArray
    Console.WriteLine(obj.ToString())
Next obj

適用対象