ParserErrorCollection.IndexOf(ParserError) メソッド

定義

コレクション内の指定した ParserError オブジェクトのインデックスを取得します。

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

パラメーター

value
ParserError

コレクション内で検索する ParserError

返品

コレクション内の ParserError オブジェクトの 0 から始まるインデックス。それ以外の場合は、 ParserError がコレクション内にない場合は 1。

次のコード例では、ParserError コレクション内の指定したインデックスでParserErrorCollection オブジェクトのインデックスを見つける方法を示します。

// Test for the presence of a ParserError in the 
// collection, and retrieve its index if it is found.
ParserError testError = new ParserError("Error", "Path", 1);
int itemIndex = -1;
if (collection.Contains(testError))
  itemIndex = collection.IndexOf(testError);
' Test for the presence of a ParserError in the 
' collection, and retrieve its index if it is found.
Dim testError As New ParserError("Error", "Path", 1)
Dim itemIndex As Integer = -1
If collection.Contains(testError) Then
  itemIndex = collection.IndexOf(testError)
End If

注釈

IndexOf メソッドを使用して、コレクション内のParserError オブジェクトのインデックスを決定します。 これは、ParserError メソッドによって返されるIEnumerator オブジェクトを使用してコレクションを反復処理するときに、各GetEnumeratorのインデックスを決定するのに役立ちます。

適用対象