CodeStatementCollection.Contains(CodeStatement) Método

Definição

Obtém um valor que indica se a coleção contém o objeto CodeStatement especificado.Gets a value that indicates whether the collection contains the specified CodeStatement object.

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

O objeto CodeStatement pelo qual pesquisar na coleção.The CodeStatement object to search for in the collection.

Retornos

Boolean

true se a coleção contiver o objeto especificado; caso contrário, false.true if the collection contains the specified object; otherwise, false.

Exemplos

O exemplo a seguir usa o Contains método para procurar a presença de um específico CodeStatement e recuperar o valor de índice no qual ele foi encontrado.The following example uses the Contains method to search for the presence of a specific CodeStatement and retrieve the index value at which it was found.

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

Aplica-se a

Confira também