ImportCollection.CopyTo Method

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

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)

public:
void CopyTo (
	array<Import^>^ array, 
	int index
)
public void CopyTo (
	Import[] array, 
	int index
)
public function CopyTo (
	array : Import[], 
	index : int
)
Not applicable.

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.

The following example demonstrates the use of the CopyTo method.

array<Import^>^myImports = gcnew array<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 );

Import myImports[] = new Import[myServiceDescription.
    get_Imports().get_Count()];

// Copy 'ImportCollection' to an array.
myServiceDescription.get_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].get_Namespace(), myImports[i].get_Location());
}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: