Freigeben über


MimePartCollection.CopyTo-Methode

Kopiert die gesamte MimePartCollection in ein kompatibles eindimensionales Array vom Typ MimePart, wobei am angegebenen nullbasierten Index des Zielarrays begonnen wird.

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)

Syntax

'Declaration
Public Sub CopyTo ( _
    array As MimePart(), _
    index As Integer _
)
'Usage
Dim instance As MimePartCollection
Dim array As MimePart()
Dim index As Integer

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

Parameter

  • array
    Ein Array vom Typ MimePart, das als Ziel des Kopiervorgangs fungiert.
  • index
    Der nullbasierte Index, an dem mit dem Platzieren der kopierten Auflistung begonnen werden soll.

Beispiel

Das folgende Beispiel veranschaulicht eine typische Verwendung der CopyTo-Methode.

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
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));
   }
}
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.get_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.get_Count(); j++) {
    Console.WriteLine("Mimepart object at position : " + j);
    for (int i = 0; i < myArray[j].get_Extensions().get_Count(); i++) {
        MimeXmlBinding myMimeXmlBinding3 = (
            MimeXmlBinding)myArray[j].get_Extensions().get_Item(i);
        Console.WriteLine("Part: " + myMimeXmlBinding3.get_Part());
    }
}

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

MimePartCollection-Klasse
MimePartCollection-Member
System.Web.Services.Description-Namespace