Share via


CodeAttributeArgumentCollection.Contains(CodeAttributeArgument) Méthode

Définition

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

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

Paramètres

value
CodeAttributeArgument

Objet CodeAttributeArgument à placer 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 objet spécifique CodeAttributeArgument dans un CodeAttributeArgumentCollection et obtient la valeur d’index à laquelle il a été trouvé.

// Tests for the presence of a CodeAttributeArgument 
// within the collection, and retrieves its index if it is found.
CodeAttributeArgument^ testArgument = gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) );
int itemIndex = -1;
if ( collection->Contains( testArgument ) )
   itemIndex = collection->IndexOf( testArgument );
// Tests for the presence of a CodeAttributeArgument
// within the collection, and retrieves its index if it is found.
CodeAttributeArgument testArgument = new CodeAttributeArgument("Test Boolean Argument", new CodePrimitiveExpression(true));
int itemIndex = -1;
if( collection.Contains( testArgument ) )
    itemIndex = collection.IndexOf( testArgument );
' Tests for the presence of a CodeAttributeArgument in 
' the collection, and retrieves its index if it is found.
Dim testArgument As New CodeAttributeArgument("Test Boolean Argument", New CodePrimitiveExpression(True))
Dim itemIndex As Integer = -1
If collection.Contains(testArgument) Then
    itemIndex = collection.IndexOf(testArgument)
End If

S’applique à