Share via


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

適用対象