CodeAttributeDeclarationCollection.Contains(CodeAttributeDeclaration) Metódus

Definíció

Lekéri vagy beállít egy értéket, amely jelzi, hogy a gyűjtemény tartalmazza-e a megadott CodeAttributeDeclaration objektumot.

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

Paraméterek

value
CodeAttributeDeclaration

A CodeAttributeDeclaration keresendő objektum.

Válaszok

trueha a gyűjtemény tartalmazza a megadott objektumot; egyéb esetben. false

Példák

Az alábbi példa egy adott Contains példány jelenlétének keresésére használja a CodeAttributeDeclaration metódust, és lekéri a talált indexértéket.

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

A következőre érvényes:

Lásd még