Compartir a través de


CodeStatementCollection.Contains(CodeStatement) Método

Definición

Obtiene un valor que indica si la colección contiene el objeto CodeStatement especificado.

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

Parámetros

value
CodeStatement

Objeto CodeStatement que se va a buscar en la colección.

Devoluciones

true si la colección contiene el objeto especificado; en caso contrario, false.

Ejemplos

En el ejemplo siguiente se usa el Contains método para buscar la presencia de un elemento específico CodeStatement y recuperar el valor de índice en el que se encontró.

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

Se aplica a

Consulte también