ParserErrorCollection.IndexOf(ParserError) Metodo

Definizione

Ottiene l'indice dell'oggetto ParserError specificato nell'insieme.

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

Parametri

value
ParserError

Oggetto ParserError da individuare nella raccolta.

Restituisce

Int32

Indice con base zero degli oggetti ParserError all'interno dell'insieme; in caso contrario, 1 se l'oggetto ParserError non è presente nell'insieme.

Esempio

Nell'esempio di codice seguente viene illustrato come individuare l'indice di un ParserError oggetto in corrispondenza dell'indice specificato in un ParserErrorCollection insieme.

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

Commenti

Utilizzare il IndexOf metodo per determinare l'indice di un ParserError oggetto all'interno dell'insieme. Ciò è utile per determinare l'indice di ogni ParserError oggetto quando si scorre l'insieme utilizzando l'oggetto IEnumerator restituito dal GetEnumerator metodo .

Si applica a