CodeCommentStatementCollection.Contains(CodeCommentStatement) Método

Definição

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

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

Parâmetros

value
CodeCommentStatement

O CodeCommentStatement a ser pesquisado 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 CodeCommentStatement e obtém o valor de índice no qual ele foi encontrado.

// Tests for the presence of a CodeCommentStatement in the 
// collection, and retrieves its index if it is found.
CodeCommentStatement^ testComment = gcnew CodeCommentStatement( "Test comment" );
int itemIndex = -1;
if ( collection->Contains( testComment ) )
   itemIndex = collection->IndexOf( testComment );
// Tests for the presence of a CodeCommentStatement in the
// collection, and retrieves its index if it is found.
CodeCommentStatement testComment = new CodeCommentStatement("Test comment");
int itemIndex = -1;
if( collection.Contains( testComment ) )
    itemIndex = collection.IndexOf( testComment );
' Tests for the presence of a CodeCommentStatement in the 
' collection, and retrieves its index if it is found.
Dim testComment As New CodeCommentStatement("Test comment")
Dim itemIndex As Integer = -1
If collection.Contains(testComment) Then
    itemIndex = collection.IndexOf(testComment)
End If

Aplica-se a

Confira também