MimePartCollection.CopyTo(MimePart[], Int32) MimePartCollection.CopyTo(MimePart[], Int32) MimePartCollection.CopyTo(MimePart[], Int32) MimePartCollection.CopyTo(MimePart[], Int32) Method

Definizione

Copia l'intero oggetto MimePartCollection in una matrice unidimensionale compatibile di tipo MimePart, a partire dall'indice in base zero specificato della matrice di destinazione.Copies the entire MimePartCollection to a compatible one-dimensional array of type MimePart, starting at the specified zero-based index of the target array.

public:
 void CopyTo(cli::array <System::Web::Services::Description::MimePart ^> ^ array, int index);
public void CopyTo (System.Web.Services.Description.MimePart[] array, int index);
member this.CopyTo : System.Web.Services.Description.MimePart[] * int -> unit
Public Sub CopyTo (array As MimePart(), index As Integer)

Parametri

array
MimePart[]

Matrice di tipo MimePart che funge da destinazione per l'azione di copia.An array of type MimePart serving as the destination for the copy action.

index
Int32 Int32 Int32 Int32

Indice a base zero all'altezza del quale iniziare a inserire l'insieme copiato.The zero-based index at which to start placing the copied collection.

Esempi

Nell'esempio seguente viene illustrato un utilizzo tipico del CopyTo metodo.The following example demonstrates a typical use of the CopyTo method.

array<MimePart^>^myArray = gcnew array<MimePart^>(myMimePartCollection->Count);

// Copy the mimepartcollection to an array.
myMimePartCollection->CopyTo( myArray, 0 );
Console::WriteLine( "Displaying the array copied from mimepartcollection" );
for ( int j = 0; j < myMimePartCollection->Count; j++ )
{
   Console::WriteLine( "Mimepart object at position : {0}", j );
   for ( int i = 0; i < myArray[ j ]->Extensions->Count; i++ )
   {
      MimeXmlBinding^ myMimeXmlBinding3 = (MimeXmlBinding^)(myArray[ j ]->Extensions[ i ]);
      Console::WriteLine( "Part: {0}", (myMimeXmlBinding3->Part) );
   }
}
MimePart[] myArray = new MimePart[myMimePartCollection.Count];
// Copy the mimepartcollection to an array.
myMimePartCollection.CopyTo(myArray,0);
Console.WriteLine("Displaying the array copied from mimepartcollection");
for(int j=0;j<myMimePartCollection.Count;j++)
{
   Console.WriteLine("Mimepart object at position : " + j);
   for(int i=0;i<myArray[j].Extensions.Count;i++)
   {
      MimeXmlBinding myMimeXmlBinding3 = (MimeXmlBinding)myArray[j].Extensions[i];
      Console.WriteLine("Part: "+(myMimeXmlBinding3.Part));
   }
}
Dim myArray(myMimePartCollection.Count-1) As MimePart
' Copy the mimepartcollection to an array.
myMimePartCollection.CopyTo(myArray, 0)
Console.WriteLine("Displaying the array copied from mimepartcollection")
Dim j As Integer
For j = 0 To myMimePartCollection.Count - 1
   Console.WriteLine("Mimepart object at position : " + j.ToString())
   For i = 0 To (myArray(j).Extensions.Count) - 1
      Dim myMimeXmlBinding3 As MimeXmlBinding = CType(myArray(j).Extensions(i), _
                                                                     MimeXmlBinding)
      Console.WriteLine("Part: " + myMimeXmlBinding3.Part)
   Next i
Next j

Si applica a