MessagePartCollection.CopyTo Method (MessagePart(), Int32)
.NET Framework (current version)
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:
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.
Dim myLocalMessage As Message = _ myServiceDescription.Messages("AddHttpPostOut") If myMessageCollection.Contains(myLocalMessage) Then Console.WriteLine("Message : " & myLocalMessage.Name) ' Get the message part collection. Dim myMessagePartCollection As MessagePartCollection = _ myLocalMessage.Parts Dim myMessagePart(myMessagePartCollection.Count) As MessagePart ' Copy the MessagePartCollection to an array. myMessagePartCollection.CopyTo(myMessagePart, 0) Dim k As Integer For k = 0 To myMessagePart.Length - 2 Console.WriteLine(ControlChars.Tab & " Part Name : " & _ myMessagePartCollection(k).Name) Next k Console.WriteLine("") End If
.NET Framework
Available since 1.1
Available since 1.1
Show: