共用方式為


OperationCollection.Insert(Int32, Operation) 方法

定義

加入指定的 OperationOperationCollection,於指定的以零起始的索引位置。

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)

備註

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

index如果 參數等於 Count ,則會 operation 將 參數新增至 的 OperationCollection 結尾。

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

適用於