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입니다.

반환

Boolean

ParserError가 컬렉션에 있으면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제에서는 지정 된 인스턴스를 검색 하는 방법을 보여 줍니다 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 개체 두 번 이상 예외를 throw 하지 것입니다. 대신, 추가 하지 못합니다. 이 경우 메서드는 Add -1 값을 반환합니다. 그러나 합니다 AddRangeInsert 메서드 반환 값 필요가 없습니다. 추가 하는 경우 ParserError 이러한 방법 중 하나를 사용 하 여 개체를 사용 합니다 Contains 특정 여부를 확인 하는 방법 ParserError 개체가 컬렉션에 이미 합니다.

적용 대상