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 컬렉션에서 찾을 위치입니다.

반품

true 컬렉션에 있으면 ParserError 이고, 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 값을 반환합니다. 그러나 메서드 및 AddRange 메서드에는 Insert 반환 값이 없습니다. 이러한 메서드 중 하나를 사용하여 개체를 추가할 ParserError 때 메서드를 Contains 사용하여 특정 ParserError 개체가 컬렉션에 이미 있는지 확인합니다.

적용 대상