Επεξεργασία

Κοινή χρήση μέσω


CodeAttributeArgumentCollection.IndexOf(CodeAttributeArgument) Method

Definition

Gets the index of the specified CodeAttributeArgument object in the collection, if it exists in the collection.

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

Parameters

value
CodeAttributeArgument

The CodeAttributeArgument object to locate in the collection.

Returns

The index of the specified object, if found, in the collection; otherwise, -1.

Examples

The following example searches for the presence of a specific CodeAttributeArgument object and uses the IndexOf method to get the index value at which it was found.

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

Applies to

See also