CodeStatementCollection.Contains(CodeStatement) Metoda

Definice

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

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

Parametry

value
CodeStatement

Objekt CodeStatement , který chcete 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 CodeStatement a načtení hodnoty indexu, na kterém byla nalezena.

// Tests for the presence of a CodeStatement in the 
// collection, and retrieves its index if it is found.
int itemIndex = -1;
if ( collection->Contains( testStatement ) )
   itemIndex = collection->IndexOf( testStatement );
// Tests for the presence of a CodeStatement in the
// collection, and retrieves its index if it is found.
int itemIndex = -1;
if( collection.Contains( testStatement ) )
    itemIndex = collection.IndexOf( testStatement );
' Tests for the presence of a CodeStatement in the 
' collection, and retrieves its index if it is found.
Dim itemIndex As Integer = -1
If collection.Contains(testStatement) Then
    itemIndex = collection.IndexOf(testStatement)
End If

Platí pro

Viz také