CodeAttributeDeclarationCollection.Contains(CodeAttributeDeclaration) Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Dient zum Abrufen oder Festlegen eines Werts, der angibt, ob die Auflistung das angegebene CodeAttributeDeclaration Objekt enthält.
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
Parameter
- value
- CodeAttributeDeclaration
Das CodeAttributeDeclaration zu suchende Objekt.
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 einer bestimmten CodeAttributeDeclaration Instanz zu suchen, und ruft den Indexwert ab, an dem sie gefunden wurde.
// 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