Partilhar via


OperationBindingCollection.Insert(Int32, OperationBinding) Método

Definição

Adiciona a instância de OperationBinding especificada ao OperationBindingCollection no índice de base zero especificado.

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

Parâmetros

index
Int32

O índice de base zero no qual inserir o parâmetro bindingOperation.

bindingOperation
OperationBinding

O OperationBinding a adicionar à coleção.

Exemplos

O exemplo a seguir demonstra o uso do método Insert.

// Insert the OperationBinding of the Add operation at index 0.
myOperationBindingCollection->Insert( 0, addOperationBinding );
Console::WriteLine( "\nInserted the OperationBinding of the "
"Add operation in the collection." );

// Get the index of the OperationBinding of the Add
// operation from the collection.
int index = myOperationBindingCollection->IndexOf( addOperationBinding );
Console::WriteLine( "\nThe index of the OperationBinding of the Add operation : {0}", index );
// Insert the OperationBinding of the Add operation at index 0.
myOperationBindingCollection.Insert(0, addOperationBinding);
Console.WriteLine("\nInserted the OperationBinding of the " +
   "Add operation in the collection.");

// Get the index of the OperationBinding of the Add
// operation from the collection.
int index = myOperationBindingCollection.IndexOf(addOperationBinding);
Console.WriteLine("\nThe index of the OperationBinding of the " +
   "Add operation : " + index);
' Insert the OperationBinding of the Add operation at index 0.
myOperationBindingCollection.Insert(0, addOperationBinding)
Console.WriteLine(ControlChars.NewLine & _
   "Inserted the OperationBinding of the " & _
   "Add operation in the collection.")

' Get the index of the OperationBinding of the Add
' operation from the collection.
Dim index As Integer = myOperationBindingCollection.IndexOf( _
   addOperationBinding)
Console.WriteLine(ControlChars.NewLine & _
   "The index of the OperationBinding of the " & _
   "Add operation : " & index.ToString())

Comentários

Se o número de itens na coleção já for igual à capacidade da coleção, a capacidade será dobrada realocando automaticamente a matriz interna antes que o novo elemento seja inserido.

Se o index parâmetro for igual a Count, o bindingOperation parâmetro será adicionado ao final do OperationBindingCollection.

Os elementos após o ponto de inserção são movidos para baixo para acomodar o novo elemento.

Aplica-se a