OperationCollection.CopyTo(Operation[], Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
複製整個 OperationCollection 至 Operation 型別的相容一維陣列,從目標陣列的指定以零起始的索引位置開始。
public:
void CopyTo(cli::array <System::Web::Services::Description::Operation ^> ^ array, int index);
public void CopyTo (System.Web.Services.Description.Operation[] array, int index);
member this.CopyTo : System.Web.Services.Description.Operation[] * int -> unit
Public Sub CopyTo (array As Operation(), index As Integer)
參數
- index
- Int32
以零起始的索引,要於此處開始放置複製的集合。
範例
下列範例示範 CopyTo
方法的用法。
array<Operation^>^myOperationArray = gcnew array<Operation^>(myOperationCollection->Count);
myOperationCollection->CopyTo( myOperationArray, 0 );
Console::WriteLine( "The operation(s) in the collection are :" );
for ( int i = 0; i < myOperationCollection->Count; i++ )
{
Console::WriteLine( " {0}", myOperationArray[ i ]->Name );
}
Operation[] myOperationArray = new Operation[
myOperationCollection.Count];
myOperationCollection.CopyTo(myOperationArray, 0);
Console.WriteLine("The operation(s) in the collection are :");
for(int i = 0; i < myOperationCollection.Count; i++)
{
Console.WriteLine(" " + myOperationArray[i].Name);
}
Dim myOperationArray(myOperationCollection.Count) As Operation
myOperationCollection.CopyTo(myOperationArray, 0)
Console.WriteLine("The operation(s) in the collection are :")
Dim i As Integer
For i = 0 To myOperationCollection.Count - 1
Console.WriteLine(" " + myOperationArray(i).Name)
Next i