ParserErrorCollection.Insert(Int32, ParserError) 方法

定義

將指定的 ParserError 物件插入至集合中所指定索引處。Inserts the specified ParserError object into the collection at the specified index.

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)

參數

index
Int32

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

value
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.
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])

備註

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.

適用於