MessagePartCollection::CopyTo Method
Copies the entire MessagePartCollection to a compatible one-dimensional array of type MessagePart, starting at the specified zero-based index of the target array.
Assembly: System.Web.Services (in System.Web.Services.dll)
Parameters
- array
- Type: array<System.Web.Services.Description::MessagePart>
An array of type MessagePart serving as the destination of the copy action.
- index
- Type: System::Int32
The zero-based index at which to start placing the copied collection.
The following example demonstrates a use of the CopyTo method.
Message^ myLocalMessage = myServiceDescription->Messages[ "AddHttpPostOut" ]; if ( myMessageCollection->Contains( myLocalMessage ) ) { Console::WriteLine( "Message : {0}", myLocalMessage->Name ); // Get the message part collection. MessagePartCollection^ myMessagePartCollection = myLocalMessage->Parts; array<MessagePart^>^myMessagePart = gcnew array<MessagePart^>(myMessagePartCollection->Count); // Copy the MessagePartCollection to an array. myMessagePartCollection->CopyTo( myMessagePart, 0 ); for ( int k = 0; k < myMessagePart->Length; k++ ) Console::WriteLine( "\t Part Name : {0}", myMessagePartCollection[ k ]->Name ); Console::WriteLine( "" ); }
Message* myLocalMessage =
myServiceDescription->Messages->Item[S"AddHttpPostOut"];
if (myMessageCollection->Contains(myLocalMessage))
{
Console::WriteLine(S"Message : {0}", myLocalMessage->Name);
// Get the message part collection.
MessagePartCollection* myMessagePartCollection = myLocalMessage->Parts;
MessagePart* myMessagePart[] =
new MessagePart*[myMessagePartCollection->Count];
// Copy the MessagePartCollection to an array.
myMessagePartCollection->CopyTo(myMessagePart, 0);
for (int k = 0; k < myMessagePart->Length; k++)
Console::WriteLine(S"\t Part Name : {0}",
myMessagePartCollection->Item[k]->Name);
Console::WriteLine(S"");
}
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.