Bagikan melalui


Evidence.CopyTo(Array, Int32) Metode

Definisi

Perhatian

Evidence should not be treated as an ICollection. Use the GetHostEnumerator and GetAssemblyEnumerator methods rather than using CopyTo.

Perhatian

Evidence should not be treated as an ICollection. Please use the GetHostEnumerator and GetAssemblyEnumerator methods rather than using CopyTo.

Perhatian

API ini sudah tidak digunakan lagi.

Menyalin objek bukti ke Array.

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

Parameter

array
Array

Array target untuk menyalin objek bukti.

index
Int32

Posisi berbasis nol dalam array tempat mulai menyalin objek bukti.

Penerapan

Atribut

Pengecualian

array adalah null.

index berada di luar rentang array target.

Contoh

Contoh kode berikut menunjukkan penggunaan CopyTo metode . Contoh ini adalah bagian dari contoh yang lebih besar yang disediakan untuk Evidence kelas .

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

Berlaku untuk