CodeAttributeArgumentCollection.IndexOf(CodeAttributeArgument) Metoda

Definice

Získá index zadaného CodeAttributeArgument objektu v kolekci, pokud existuje v kolekci.

public:
 int IndexOf(System::CodeDom::CodeAttributeArgument ^ value);
public int IndexOf (System.CodeDom.CodeAttributeArgument value);
member this.IndexOf : System.CodeDom.CodeAttributeArgument -> int
Public Function IndexOf (value As CodeAttributeArgument) As Integer

Parametry

value
CodeAttributeArgument

Objekt CodeAttributeArgument , který se má v kolekci najít.

Návraty

Index zadaného objektu, pokud je nalezen, v kolekci; v opačném případě -1.

Příklady

Následující příklad vyhledá přítomnost konkrétního CodeAttributeArgument objektu a použije metodu IndexOf k získání hodnoty indexu, ve které 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

Viz také