ParserErrorCollection.Contains(ParserError) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Determines whether the ParserError object is located in the collection.
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
Parameters
- value
- ParserError
The ParserError to locate in the collection.
Returns
true
if the ParserError is in the collection; otherwise, false
.
Examples
The following code example demonstrates how to search for an instance of a specified ParserError object in a ParserErrorCollection object.
// 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
Remarks
You cannot add the same ParserError object to the collection more than once. However, attempting to add a ParserError object more than once will not throw an exception. Instead, the addition will fail. In this case, the Add method will return a value of -1. However, the AddRange and Insert methods do not have return values. When adding ParserError objects by using one of these methods, use the Contains method to determine whether a particular ParserError object is already in the collection.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기