ParserErrorCollection.IndexOf(ParserError) Yöntem

Tanım

Koleksiyonda belirtilen ParserError nesnenin dizinini alır.

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

Parametreler

value
ParserError

ParserError koleksiyonda bulmak için.

Döndürülenler

Koleksiyon içindeki nesnelerin sıfır tabanlı dizini ParserError ; aksi takdirde, koleksiyonunda değilse ParserError 1.

Örnekler

Aşağıdaki kod örneği, bir koleksiyonda belirtilen dizinde bir ParserError nesnenin dizinini ParserErrorCollection bulma işlemini gösterir.

// 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

Açıklamalar

IndexOf yöntemini kullanarak koleksiyondaki bir ParserError nesnenin dizinini belirleyin. Bu, yöntemi tarafından döndürülen nesnesini kullanarak koleksiyonda yineleme yaptığınızda her ParserError birinin dizinini IEnumeratorGetEnumerator belirlemek için yararlıdır.

Şunlara uygulanır