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