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。

示例

下面的代码示例演示如何将对象添加到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 对象添加到集合中。 使用Add集合中已有的对象调用ParserError该方法时,添加会失败并返回 -1。

若要将多个对象添加到集合,请使用 AddRange 该方法。

适用于