語言

OperationCollection.Insert(Int32, Operation) 方法

定義

將指定的 Operation 加到 指定的 OperationCollection 零基索引。

public:
 void Insert(int index, System::Web::Services::Description::Operation ^ operation);
public void Insert(int index, System.Web.Services.Description.Operation operation);
member this.Insert : int * System.Web.Services.Description.Operation -> unit
Public Sub Insert (index As Integer, operation As Operation)

參數

index
Int32

以零為基礎的索引,用以插入參數 operation 。

operation
Operation

Operation加入收藏。

範例

下列範例示範 Insert 方法的用法。

myOperationCollection->Remove( myOperation );

// Insert the 'myOpearation' operation at the index '0'.
myOperationCollection->Insert( 0, myOperation );
Console::WriteLine( "The operation at index '0' is : {0}", myOperationCollection[ 0 ]->Name );
myOperationCollection.Remove(myOperation);
// Insert the 'myOpearation' operation at the index '0'.
myOperationCollection.Insert(0, myOperation);
Console.WriteLine("The operation at index '0' is : " +
                  myOperationCollection[0].Name);
myOperationCollection.Remove(myOperation)
' Insert the 'myOpearation' operation at the index '0'.
myOperationCollection.Insert(0, myOperation)
Console.WriteLine("The operation at index '0' is : " + _
                  myOperationCollection.Item(0).Name)

備註

如果集合中的項目數量已經等於集合容量,則在插入新元素前,會自動重新配置內部陣列,容量會加倍。

若indexCount參數等於 ,operation則參數加於 末尾OperationCollection。

插入點之後的元素會向下移動以容納新元素。

適用於