CodeStatementCollection.IndexOf(CodeStatement) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient l’index de l’objet spécifié CodeStatement dans le CodeStatementCollection, s’il existe dans la collection.
public:
int IndexOf(System::CodeDom::CodeStatement ^ value);
public int IndexOf(System.CodeDom.CodeStatement value);
member this.IndexOf : System.CodeDom.CodeStatement -> int
Public Function IndexOf (value As CodeStatement) As Integer
Paramètres
- value
- CodeStatement
À CodeStatement localiser dans la collection.
Retours
Index de l’objet spécifié, s’il est trouvé, dans la collection ; sinon, -1.
Exemples
L’exemple suivant recherche la présence d’un élément spécifique CodeStatement et utilise la IndexOf méthode pour récupérer la valeur d’index à laquelle elle a été trouvée.
// Tests for the presence of a CodeStatement in the
// collection, and retrieves its index if it is found.
int itemIndex = -1;
if( collection.Contains( testStatement ) )
itemIndex = collection.IndexOf( testStatement );
' Tests for the presence of a CodeStatement in the
' collection, and retrieves its index if it is found.
Dim itemIndex As Integer = -1
If collection.Contains(testStatement) Then
itemIndex = collection.IndexOf(testStatement)
End If