Freigeben über


CodeAttributeDeclarationCollection.Contains(CodeAttributeDeclaration) Methode

Definition

Ruft einen Wert ab, der angibt, ob die Auflistung das angegebene CodeAttributeDeclaration-Objekt enthält, oder legt diesen fest.

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 zu suchende CodeAttributeDeclaration-Objekt.

Gibt zurück

true, wenn die Auflistung das angegebene Objekt enthält, andernfalls false.

Beispiele

Im folgenden Beispiel wird die Contains -Methode verwendet, um nach dem Vorhandensein eines bestimmten CodeAttributeDeclaration instance zu suchen, und ruft den Indexwert ab, bei dem er gefunden wurde.

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

Gilt für:

Weitere Informationen