CodeAttributeArgumentCollection.Contains(CodeAttributeArgument) Methode

Definition

Ruft einen Wert ab, der angibt, ob die Auflistung das angegebene CodeAttributeArgument Objekt enthält.

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

Parameter

value
CodeAttributeArgument

Das CodeAttributeArgument Objekt, das in der Auflistung gefunden werden soll.

Gibt zurück

truewenn die Auflistung das angegebene Objekt enthält; andernfalls . false

Beispiele

Im folgenden Beispiel wird die Contains Methode verwendet, um nach dem Vorhandensein eines bestimmten CodeAttributeArgument Objekts in einem CodeAttributeArgumentCollection und ruft den Indexwert ab, an dem es gefunden wurde.

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

Gilt für: