Share via


CodeNamespaceCollection.Contains(CodeNamespace) Méthode

Définition

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

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

Paramètres

value
CodeNamespace

CodeNamespace à rechercher dans la collection.

Retours

true si CodeNamespace est contenu dans la collection ; sinon false.

Exemples

L’exemple suivant utilise la Contains méthode pour rechercher un CodeNamespace objet dans un CodeNamespaceCollection.

// Tests for the presence of a CodeNamespace in the collection,
// and retrieves its index if it is found.
CodeNamespace^ testNamespace = gcnew CodeNamespace( "TestNamespace" );
int itemIndex = -1;
if ( collection->Contains( testNamespace ) )
   itemIndex = collection->IndexOf( testNamespace );
// Tests for the presence of a CodeNamespace in the collection,
// and retrieves its index if it is found.
CodeNamespace testNamespace = new CodeNamespace("TestNamespace");
int itemIndex = -1;
if( collection.Contains( testNamespace ) )
    itemIndex = collection.IndexOf( testNamespace );
' Tests for the presence of a CodeNamespace in the collection,
' and retrieves its index if it is found.
Dim testNamespace As New CodeNamespace("TestNamespace")
Dim itemIndex As Integer = -1
If collection.Contains(testNamespace) Then
    itemIndex = collection.IndexOf(testNamespace)
End If

S’applique à

Voir aussi