Compartir a través de


CodeAttributeArgumentCollection.Contains(CodeAttributeArgument) Método

Definición

Obtiene un valor que indica si la colección contiene el objeto CodeAttributeArgument especificado.

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

Parámetros

value
CodeAttributeArgument

Objeto CodeAttributeArgument 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 usa el Contains método para buscar la presencia de un objeto específico CodeAttributeArgument en CodeAttributeArgumentCollection y se obtiene el valor de índice en el que se encontró.

// Tests for the presence of a CodeAttributeArgument 
// within the collection, and retrieves its index if it is found.
CodeAttributeArgument^ testArgument = gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) );
int itemIndex = -1;
if ( collection->Contains( testArgument ) )
   itemIndex = collection->IndexOf( testArgument );
// Tests for the presence of a CodeAttributeArgument
// within the collection, and retrieves its index if it is found.
CodeAttributeArgument testArgument = new CodeAttributeArgument("Test Boolean Argument", new CodePrimitiveExpression(true));
int itemIndex = -1;
if( collection.Contains( testArgument ) )
    itemIndex = collection.IndexOf( testArgument );
' Tests for the presence of a CodeAttributeArgument in 
' the collection, and retrieves its index if it is found.
Dim testArgument As New CodeAttributeArgument("Test Boolean Argument", New CodePrimitiveExpression(True))
Dim itemIndex As Integer = -1
If collection.Contains(testArgument) Then
    itemIndex = collection.IndexOf(testArgument)
End If

Se aplica a