ParserErrorCollection.Insert(Int32, ParserError) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將指定的 ParserError 物件插入集合中指定的索引。
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.
- value
- ParserError
ParserError要插入收藏的物件。
範例
以下程式碼範例示範如何在 ParserError 集合中插入指定的索引 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])
備註
使用此 Insert 方法在集合中插入特定索引的現有 ParserError 物件。
你不能將同 ParserError 一個物件加入收藏超過一次。 當你用集合中已經存在的 a Insert 呼叫ParserError該方法時,插入失敗。 在插入前使用 Contains 該方法判斷某個特定 ParserError 是否已經在集合中。 若要在集合中重新定位 a ParserError ,必須先用 的方法 Remove 移除它,然後用 將它插入到想要的索引 Insert位置。