Udostępnij za pośrednictwem


CodeAttributeDeclarationCollection.Contains(CodeAttributeDeclaration) Metoda

Definicja

Pobiera lub ustawia wartość wskazującą, czy kolekcja zawiera określony CodeAttributeDeclaration obiekt.

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

Parametry

value
CodeAttributeDeclaration

Obiekt CodeAttributeDeclaration do zlokalizowania.

Zwraca

true jeśli kolekcja zawiera określony obiekt; w przeciwnym razie , false.

Przykłady

W poniższym przykładzie Contains użyto metody , aby wyszukać obecność określonego CodeAttributeDeclaration wystąpienia i uzyskać wartość indeksu, w której została znaleziona.

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

Dotyczy

Zobacz też