CodeAttributeArgumentCollection.Contains(CodeAttributeArgument) Methode

Definitie

Hiermee wordt een waarde opgehaald die aangeeft of de verzameling het opgegeven CodeAttributeArgument object bevat.

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

Parameters

value
CodeAttributeArgument

Het CodeAttributeArgument object dat in de verzameling moet worden gevonden.

Retouren

true als de verzameling het opgegeven object bevat; anders, false.

Voorbeelden

In het volgende voorbeeld wordt de Contains methode gebruikt om te zoeken naar de aanwezigheid van een specifiek CodeAttributeArgument object in een CodeAttributeArgumentCollection en wordt de indexwaarde opgehaald waarop het is gevonden.

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

Van toepassing op