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

戻り値

Int32

コレクション内の 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インデックスをIEnumeratorGetEnumerator特定するのに役立ちます。

適用対象