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 值。

傳回

Int32

集合中的值索引,否則為 -1 (前提是該值已在集合中)。

範例

下列程式碼範例示範如何將 物件新增 ParserErrorParserErrorCollection 物件。

// 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 物件新增至集合。 當您使用 ParserError 已經在集合中的 物件呼叫 Add 方法時,加法會失敗並傳回 -1。

若要將多個物件新增至集合,請使用 AddRange 方法。

適用於