Compartir a través de


CodeTypeDeclarationCollection.Contains(CodeTypeDeclaration) Método

Definición

Obtiene un valor que indica si la colección contiene el 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

Objeto CodeTypeDeclaration 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 muestra cómo usar el Contains método para buscar un CodeTypeDeclaration objeto en .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

Se aplica a

Consulte también