CodeTypeDeclarationCollection.Contains(CodeTypeDeclaration) Método

Definição

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

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

Parâmetros

value
CodeTypeDeclaration

O objeto CodeTypeDeclaration pelo qual pesquisar na coleção.

Retornos

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

Exemplos

O exemplo a seguir demonstra como usar o Contains método para localizar um CodeTypeDeclaration objeto em um CodeTypeDeclarationCollection.

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

Aplica-se a

Confira também