CodeAttributeArgumentCollection.IndexOf(CodeAttributeArgument) Metodo

Definizione

Ottiene l'indice dell'oggetto specificato CodeAttributeArgument nell'insieme, se presente nell'insieme.

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

Parametri

value
CodeAttributeArgument

Oggetto CodeAttributeArgument da individuare nell'insieme.

Valori restituiti

Indice dell'oggetto specificato, se trovato, nell'insieme; in caso contrario, -1.

Esempio

Nell'esempio seguente viene eseguita la ricerca della presenza di un oggetto specifico CodeAttributeArgument e viene utilizzato il IndexOf metodo per ottenere il valore di indice in corrispondenza del quale è stato trovato.

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

Si applica a

Vedi anche