ParserErrorCollection.Insert(Int32, ParserError) Metod

Definition

Infogar det angivna ParserError objektet i samlingen vid det angivna indexet.

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

Parametrar

index
Int32

Indexet i samlingen där du ska infoga ParserError.

value
ParserError

Objektet ParserError som ska infogas i samlingen.

Exempel

Följande kodexempel visar hur du infogar ett ParserError objekt vid det angivna indexet i en ParserErrorCollection samling.

// Insert a ParserError at index 0 of the collection.
ParserError error = new ParserError("Error", "Path", 1);
collection.Insert(0, error);

// Remove the specified ParserError from the collection.
collection.Remove(error);
' Insert a ParserError at index 0 of the collection.
Dim [error] As New ParserError("Error", "Path", 1)
collection.Insert(0, [error])

' Remove the specified ParserError from the collection.
collection.Remove([error])

Kommentarer

Insert Använd metoden för att infoga ett befintligt ParserError objekt i ett visst index i samlingen.

Du kan inte lägga till samma ParserError objekt i samlingen mer än en gång. När du anropar Insert metoden med hjälp av en ParserError som redan finns i samlingen misslyckas infogningen. Contains Använd metoden före infogningen för att avgöra om en viss redan ParserError finns i samlingen. Om du vill flytta en ParserError i samlingen måste du först ta bort den Remove med hjälp av metoden och sedan infoga den i önskat index med hjälp Insertav .

Gäller för