Share via


CodeStatementCollection.Contains(CodeStatement) Méthode

Définition

Obtient une valeur qui indique si la collection contient l'CodeStatement spécifiée.

public:
 bool Contains(System::CodeDom::CodeStatement ^ value);
public bool Contains (System.CodeDom.CodeStatement value);
member this.Contains : System.CodeDom.CodeStatement -> bool
Public Function Contains (value As CodeStatement) As Boolean

Paramètres

value
CodeStatement

Objet CodeStatement à rechercher dans la collection.

Retours

true si la collection contient l'objet spécifié ; sinon false.

Exemples

L’exemple suivant utilise la Contains méthode pour rechercher la présence d’un spécifique CodeStatement et récupérer la valeur d’index à laquelle il a été trouvé.

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

S’applique à

Voir aussi