ImportCollection.CopyTo(Import[], Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将整个 ImportCollection 复制到兼容的、Import 类型的一维数组(从目标数组的指定的从零开始的索引处开始复制)。
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)
参数
- index
- Int32
将在该处开始放置所复制的集合的从零开始的索引。
示例
下面的示例演示 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