ParserErrorCollection.Add(ParserError) 方法

定義

為收藏增添價值。

public:
 int Add(System::Web::ParserError ^ value);
public int Add(System.Web.ParserError value);
member this.Add : System.Web.ParserError -> int
Public Function Add (value As ParserError) As Integer

參數

value
ParserError

ParserError為收藏增添的價值。

傳回

集合中值的索引;否則,-1 該值是否已經在集合中。

範例

以下程式碼範例示範如何將物件加入ParserError物件。ParserErrorCollection

// Add a ParserError to the collection.
collection.Add(new ParserError("ErrorName", "Path", 1));
' Add a ParserError to the collection.
collection.Add(New ParserError("ErrorName", "Path", 1))

備註

使用該 Add 方法將現有 ParserError 物件加入收藏。 你不能將同 ParserError 一個物件加入收藏超過一次。 當你使用Add集合中已存在的物件呼叫該ParserError方法時,加法失敗,-1 會被回傳。

若要將多個物件加入集合,請使用以下 AddRange 方法。

適用於