ParserErrorCollection.Insert(Int32, ParserError) Metoda

Definice

Vloží zadaný ParserError objekt do kolekce v zadaném indexu.

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)

Parametry

index
Int32

Index v kolekci, do které chcete vložit ParserError.

value
ParserError

Objekt ParserError , který chcete vložit do kolekce.

Příklady

Následující příklad kódu ukazuje, jak vložit ParserError objekt na zadaný index v kolekci ParserErrorCollection .

// 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])

Poznámky

Insert Metoda slouží k vložení existujícího ParserError objektu do konkrétního indexu v kolekci.

Do kolekce nelze přidat stejný ParserError objekt více než jednou. Když metodu Insert zavoláte pomocí objektu ParserError , který už je v kolekci, vložení selže. Použijte metodu Contains před vložením k určení, zda je konkrétní ParserError již v kolekci. Chcete-li přemístit ParserError uvnitř kolekce, musíte ji nejprve odebrat pomocí Remove metody a potom ji vložit do požadovaného indexu pomocí Insert.

Platí pro