CodeExpressionCollection.Contains(CodeExpression) Método

Definição

Obtém um valor que indica se a coleção contém o objeto CodeExpression especificado.

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

Parâmetros

value
CodeExpression

O objeto CodeExpression a ser localizado na coleção.

Retornos

true se a coleção contiver o objeto especificado; caso contrário, false.

Exemplos

O exemplo a seguir usa o Contains método para pesquisar a presença de um objeto específico CodeExpression e obtém o valor de índice no qual ele foi encontrado.

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

Aplica-se a

Confira também