Compartir vía


CodeAttributeDeclarationCollection.Contains(CodeAttributeDeclaration) Método

Definición

Obtiene o establece un valor que indica si la colección contiene el objeto CodeAttributeDeclaration especificado.

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

Parámetros

value
CodeAttributeDeclaration

Objeto CodeAttributeDeclaration que se va a buscar.

Devoluciones

true si la colección contiene el objeto especificado; en caso contrario, false.

Ejemplos

En el ejemplo siguiente se usa el Contains método para buscar la presencia de una instancia específica CodeAttributeDeclaration y se obtiene el valor de índice en el que se encontró.

// Tests for the presence of a CodeAttributeDeclaration in 
// the collection, and retrieves its index if it is found.
array<CodeAttributeArgument^>^temp3 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
CodeAttributeDeclaration^ testdeclaration = gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp3 );
int itemIndex = -1;
if ( collection->Contains( testdeclaration ) )
   itemIndex = collection->IndexOf( testdeclaration );
// Tests for the presence of a CodeAttributeDeclaration in
// the collection, and retrieves its index if it is found.
CodeAttributeDeclaration testdeclaration = new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description")) );
int itemIndex = -1;
if( collection.Contains( testdeclaration ) )
    itemIndex = collection.IndexOf( testdeclaration );
' Tests for the presence of a CodeAttributeDeclaration in the 
' collection, and retrieves its index if it is found.
Dim testdeclaration As New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description")))
Dim itemIndex As Integer = -1
If collection.Contains(testdeclaration) Then
    itemIndex = collection.IndexOf(testdeclaration)
End If

Se aplica a

Consulte también