ImportCollection.CopyTo(Import[], Int32) Methode

Definitie

Kopieert het hele ImportCollection naar een compatibele eendimensionale matrix van het type Import, beginnend bij de opgegeven op nul gebaseerde index van de doelmatrix.

public:
 void CopyTo(cli::array <System::Web::Services::Description::Import ^> ^ array, int index);
public void CopyTo(System.Web.Services.Description.Import[] array, int index);
member this.CopyTo : System.Web.Services.Description.Import[] * int -> unit
Public Sub CopyTo (array As Import(), index As Integer)

Parameters

array
Import[]

Een matrix van het type Import dat fungeert als de bestemming van de kopieeractie.

index
Int32

De op nul gebaseerde index waarop de gekopieerde verzameling moet worden geplaatst.

Voorbeelden

In het volgende voorbeeld ziet u het gebruik van de methode CopyTo.

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.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);
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

Van toepassing op