OperationCollection.Insert(Int32, Operation) Metod

Definition

Lägger till Operation det angivna OperationCollection i det angivna nollbaserade indexet.

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)

Parametrar

index
Int32

Det nollbaserade index där parametern ska infogas operation .

operation
Operation

Att Operation lägga till i samlingen.

Exempel

I följande exempel visas användningen av metoden 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)

Kommentarer

Om antalet objekt i samlingen redan är lika med samlingens kapacitet, fördubblas kapaciteten genom att den interna matrisen omplaceras automatiskt innan det nya elementet infogas.

Om parametern index är lika med Countläggs parametern operation till i slutet av OperationCollection.

Elementen efter insättningspunkten flyttas ned för att rymma det nya elementet.

Gäller för