แก้ไข

แชร์ผ่าน


OperationCollection.Insert(Int32, Operation) Method

Definition

Adds the specified Operation to the OperationCollection at the specified zero-based index.

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)

Parameters

index
Int32

The zero-based index at which to insert the operation parameter.

operation
Operation

The Operation to add to the collection.

Examples

The following example demonstrates the use of the Insert method.

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)

Remarks

If the number of items in the collection already equals the collection's capacity, the capacity is doubled by automatically reallocating the internal array before the new element is inserted.

If the index parameter is equal to Count, the operation parameter is added to the end of the OperationCollection.

The elements after the insertion point move down to accommodate the new element.

Applies to