CodeExpressionCollection.Contains(CodeExpression) Metoda

Definice

Získá hodnotu, která označuje, zda kolekce obsahuje zadaný CodeExpression objekt.

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

Parametry

value
CodeExpression

Objekt CodeExpression , který se má vyhledat v kolekci.

Návraty

truePokud kolekce obsahuje zadaný objekt; v opačném případě . false

Příklady

Následující příklad používá metodu Contains k vyhledání přítomnosti konkrétního CodeExpression objektu a získá hodnotu indexu, ve kterém byl nalezen.

// Tests for the presence of a CodeExpression in the 
// collection, and retrieves its index if it is found.
CodeExpression^ testComment = gcnew 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.
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

Platí pro

Viz také