CodeExpressionCollection.Contains(CodeExpression) Metódus

Definíció

Olyan értéket kap, amely jelzi, hogy a gyűjtemény tartalmazza-e a megadott CodeExpression objektumot.

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

Paraméterek

value
CodeExpression

A CodeExpression gyűjteményben 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 objektum jelenlétének keresésére használja a CodeExpression metódust, és lekéri a talált indexértéket.

// Tests for the presence of a CodeExpression in the
// collection, and retrieves its index if it is found.
CodeExpression testComment = new CodePrimitiveExpression(true);
int itemIndex = -1;
if( collection.Contains( testComment ) )
    itemIndex = collection.IndexOf( testComment );
' Tests for the presence of a CodeExpression in the 
' collection, and retrieves its index if it is found.
Dim testComment = New CodePrimitiveExpression(True)
Dim itemIndex As Integer = -1
If collection.Contains(testComment) Then
    itemIndex = collection.IndexOf(testComment)
End If

A következőre érvényes:

Lásd még