CodeAttributeArgumentCollection.Contains(CodeAttributeArgument) Método

Definição

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

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

O CodeAttributeArgument objeto a localizar na coleção.

Devoluções

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

Exemplos

O exemplo seguinte utiliza o Contains método para procurar a presença de um objeto específico CodeAttributeArgument em um CodeAttributeArgumentCollection e obtém o valor do índice em que foi encontrado.

// 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

Aplica-se a