MimePartCollection.CopyTo(MimePart[], Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
複製整個 MimePartCollection 至 MimePart 型別的相容一維陣列,從目標陣列的指定以零起始的索引位置開始。
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)
參數
- index
- Int32
以零起始的索引,要於此處開始放置複製的集合。
範例
下列範例示範 方法的 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