CodeAttributeDeclarationCollection.Contains(CodeAttributeDeclaration) Methode

Definitie

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

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

Parameters

value
CodeAttributeDeclaration

Het CodeAttributeDeclaration object dat 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 CodeAttributeDeclaration exemplaar en wordt de indexwaarde opgehaald waarmee deze is gevonden.

// Tests for the presence of a CodeAttributeDeclaration in
// the collection, and retrieves its index if it is found.
CodeAttributeDeclaration testdeclaration = new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description")) );
int itemIndex = -1;
if( collection.Contains( testdeclaration ) )
    itemIndex = collection.IndexOf( testdeclaration );
' Tests for the presence of a CodeAttributeDeclaration in the 
' collection, and retrieves its index if it is found.
Dim testdeclaration As New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description")))
Dim itemIndex As Integer = -1
If collection.Contains(testdeclaration) Then
    itemIndex = collection.IndexOf(testdeclaration)
End If

Van toepassing op

Zie ook