This documentation is archived and is not being maintained.
ImportCollection.CopyTo Method
.NET Framework 1.1
Copies the entire ImportCollection to a compatible one-dimensional array of type Import, starting at the specified zero-based index of the target array.
[Visual Basic] Public Sub CopyTo( _ ByVal array() As Import, _ ByVal index As Integer _ ) [C#] public void CopyTo( Import[] array, int index ); [C++] public: void CopyTo( Import* array[], int index ); [JScript] public function CopyTo( array : Import[], index : int );
Parameters
- array
- An array of type Import serving as the destination of 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 myImports(myServiceDescription.Imports.Count - 1) As Import ' Copy 'ImportCollection' to an array. myServiceDescription.Imports.CopyTo(myImports, 0) Console.WriteLine("Imports that are copied to Importarray ...") Dim j As Integer For j = 0 To myImports.Length - 1 Console.WriteLine(ControlChars.Tab + _ "Import Namespace :{0} Import Location :{1} ", _ myImports(j).Namespace, myImports(j).Location) Next j [C#] Import[] myImports = new Import[myServiceDescription.Imports.Count]; // Copy 'ImportCollection' to an array. myServiceDescription.Imports.CopyTo(myImports,0); Console.WriteLine("Imports that are copied to Importarray ..."); for(int i=0;i < myImports.Length; ++i) Console.WriteLine("\tImport Namespace :{0} Import Location :{1} " ,myImports[i].Namespace ,myImports[i].Location); [C++] Import* myImports[] = new Import*[myServiceDescription->Imports->Count]; // Copy 'ImportCollection' to an array. myServiceDescription->Imports->CopyTo(myImports, 0); Console::WriteLine(S"Imports that are copied to Importarray ..."); for (int i=0;i < myImports->Length; ++i) Console::WriteLine(S"\tImport Namespace : {0} Import Location : {1} ", myImports[i]->Namespace, myImports[i]->Location );
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
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
ImportCollection Class | ImportCollection Members | System.Web.Services.Description Namespace
Show: