CodeAttributeArgumentCollection.Contains(CodeAttributeArgument) Metoda

Definice

Získá hodnotu, která označuje, zda kolekce obsahuje zadaný CodeAttributeArgument objekt.

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

Parametry

value
CodeAttributeArgument

Objekt CodeAttributeArgument , který se má vyhledat v kolekci.

Návraty

truePokud kolekce obsahuje zadaný objekt; v opačném případě . false

Příklady

Následující příklad používá metodu Contains k vyhledání přítomnosti konkrétního CodeAttributeArgument objektu v objektu CodeAttributeArgumentCollection a získá hodnotu indexu, na kterém byl nalezen.

// Tests for the presence of a CodeAttributeArgument 
// within the collection, and retrieves its index if it is found.
CodeAttributeArgument^ testArgument = gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) );
int itemIndex = -1;
if ( collection->Contains( testArgument ) )
   itemIndex = collection->IndexOf( testArgument );
// 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

Platí pro