Share via


ImportCollection.CopyTo(Import[], Int32) メソッド

定義

ImportCollection 全体を互換性のある Import 型の 1 次元配列にコピーします。コピーは、コピー先の配列の、指定した 0 から始まるインデックス番号から開始します。

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)

パラメーター

array
Import[]

コピー アクションのコピー先として使用する Import 型の配列。

index
Int32

コピーされたコレクションの貼り付け開始位置を示す、0 から始まるインデックス番号。

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

適用対象