ParserErrorCollection.Insert(Int32, ParserError) メソッド

定義

指定した 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 オブジェクトをコレクションに複数回追加することはできません。 既にコレクション内にあるInsertを使用して ParserError メソッドを呼び出すと、挿入は失敗します。 挿入の前に Contains メソッドを使用して、特定の ParserError が既にコレクション内にあるかどうかを判断します。 コレクション内の ParserError の位置を変更するには、最初に Remove メソッドを使用して削除してから、 Insertを使用して目的のインデックスに挿入する必要があります。

適用対象