ParserErrorCollection.Insert(Int32, ParserError) 方法


将指定的 ParserError 对象插入集合中指定的索引位置。Inserts the specified ParserError object into the collection at the specified index.

 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)



在集合中要插入 ParserError 的索引位置。The index within the collection at which to insert the ParserError.


要插入到集合中的 ParserError 对象。The ParserError object to insert into the collection.


下面的代码示例演示如何在 ParserError 集合中的指定索引处插入对象 ParserErrorCollectionThe following code example demonstrates how to insert a ParserError object at the specified index in a ParserErrorCollection collection.

// 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.
' 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.


使用 Insert 方法可将现有对象插入到 ParserError 集合中的特定索引处。Use the Insert method to insert an existing ParserError object at a particular index within the collection.

不能将同一个 ParserError 对象多次添加到集合中。You cannot add the same ParserError object to the collection more than once. Insert 使用 ParserError 集合中已有的调用方法时,插入操作将失败。When you call the Insert method by using a ParserError that is already in the collection, the insertion fails. 使用 Contains 插入前的方法来确定 ParserError 集合中是否已存在特定的。Use the Contains method before the insertion to determine whether a particular ParserError is already in the collection. 若要 ParserError 在集合中重新定位,必须先使用方法将其移除, Remove 然后使用将其插入到所需的索引处 InsertTo reposition a ParserError within the collection, you must first remove it by using the Remove method and then insert it at the desired index by using Insert.