This documentation is archived and is not being maintained.

ServiceDescriptionCollection.CopyTo Method

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

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

Parameters

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

Example

[Visual Basic] 
Dim myArray(myCollection.Count -1 ) As ServiceDescription

' Copy the collection to a ServiceDescription array.
myCollection.CopyTo(myArray, 0)
Dim i As Integer
For i = 0 To myArray.Length - 1
   Console.WriteLine("Name of element in array: " & _
   myArray(i).Name)
Next i

[C#] 
ServiceDescription[] myArray = 
   new ServiceDescription[myCollection.Count];

// Copy the collection to a ServiceDescription array.
myCollection.CopyTo(myArray,0);
for(int i = 0; i < myArray.Length; i++)
{
   Console.WriteLine("Name of element in array: " + 
      myArray[i].Name);
}

[C++] 
ServiceDescription* myArray[] = 
   new ServiceDescription*[myCollection->Count];

// Copy the collection to a ServiceDescription array.
myCollection->CopyTo(myArray, 0);
for (int i = 0; i < myArray->Length; i++)
   Console::WriteLine(S"Name of element in array: {0}", 
      myArray[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

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

Show: