ParserErrorCollection.Contains(ParserError) メソッド

定義

ParserError オブジェクトがコレクション内にあるかどうかを判断します。

public:
 bool Contains(System::Web::ParserError ^ value);
public bool Contains(System.Web.ParserError value);
member this.Contains : System.Web.ParserError -> bool
Public Function Contains (value As ParserError) As Boolean

パラメーター

value
ParserError

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

返品

がコレクション内にある場合は a0/&。それ以外の場合は。

次のコード例では、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

注釈

同じ ParserError オブジェクトをコレクションに複数回追加することはできません。 ただし、 ParserError オブジェクトを複数回追加しようとすると、例外はスローされません。 代わりに、追加は失敗します。 この場合、 Add メソッドは -1 の値を返します。 ただし、 AddRange メソッドと Insert メソッドには戻り値がありません。 これらのメソッドのいずれかを使用して ParserError オブジェクトを追加する場合は、 Contains メソッドを使用して、特定の ParserError オブジェクトがコレクション内に既にあるかどうかを判断します。

適用対象