다음을 통해 공유


MimePartCollection.CopyTo(MimePart[], Int32) 메서드

정의

대상 배열의 지정된 인덱스(0부터 시작)에서 시작하여 전체 MimePartCollectionMimePart 형식의 호환되는 1차원 배열에 복사합니다.

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)

매개 변수

array
MimePart[]

복사될 대상인 MimePart 형식의 배열입니다.

index
Int32

복사된 컬렉션을 배치하기 시작할 인덱스(0부터 시작)입니다.

예제

다음 예제에서는의 일반적인 용도 CopyTo 메서드.

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

적용 대상