Evidence.CopyTo(Array, Int32) Método

Definição

Cuidado

Esta API agora é obsoleta.

Cuidado

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

Copia objetos de evidência em um Array.Copies evidence objects to an Array.

public:
 virtual void CopyTo(Array ^ array, int index);
[System.Obsolete]
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>]
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
Public Sub CopyTo (array As Array, index As Integer)

Parâmetros

array
Array

A matriz de destino para os objetos de evidência a serem copiados.The target array to which to copy evidence objects.

index
Int32

A posição de base zero na matriz para o qual começar a copiar objetos de evidência.The zero-based position in the array to which to begin copying evidence objects.

Implementações

Atributos

Exceções

array é nulo.array is null.

index está fora do intervalo da matriz de destino.index is outside the range of the target array.

Exemplos

O exemplo de código a seguir mostra o uso do CopyTo método.The following code example shows the use of the CopyTo method. Este exemplo faz parte de um exemplo maior fornecido para a Evidence classe.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

Aplica-se a