This documentation is archived and is not being maintained.

OperationCollection.CopyTo Method

Copies the entire OperationCollection to a compatible one-dimensional array of type Operation, starting at the specified zero-based index of the target array.

[Visual Basic]
Public Sub CopyTo( _
   ByVal array() As Operation, _
   ByVal index As Integer _
)
[C#]
public void CopyTo(
 Operation[] array,
 int index
);
[C++]
public: void CopyTo(
 Operation* array[],
 int index
);
[JScript]
public function CopyTo(
   array : Operation[],
 index : int
);

Parameters

array
An array of type Operation serving as the destination for the copy action.
index
The zero-based index at which to start placing the copied collection.

Example

[Visual Basic, C#, C++] The following example demonstrates the use of the CopyTo method.

[Visual Basic] 
Dim myOperationArray(myOperationCollection.Count) As Operation
myOperationCollection.CopyTo(myOperationArray, 0)
Console.WriteLine("The operation(s) in the collection are :")
Dim i As Integer
For i = 0 To myOperationCollection.Count - 1
   Console.WriteLine(" " + myOperationArray(i).Name)
Next i

[C#] 
Operation[] myOperationArray = new Operation[
                                    myOperationCollection.Count];
myOperationCollection.CopyTo(myOperationArray, 0);
Console.WriteLine("The operation(s) in the collection are :");
for(int i = 0; i < myOperationCollection.Count; i++)
{
   Console.WriteLine(" " + myOperationArray[i].Name);
}

[C++] 
Operation* myOperationArray[] = new Operation*[myOperationCollection->Count];
myOperationCollection->CopyTo(myOperationArray, 0);
Console::WriteLine(S"The operation(s) in the collection are :");
for(int i = 0; i < myOperationCollection->Count; i++)
{
   Console::WriteLine(S" {0}", myOperationArray[i]->Name);
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

OperationCollection Class | OperationCollection Members | System.Web.Services.Description Namespace

Show: