CodeStatementCollection.IndexOf(CodeStatement) Método

Definição

Obtém o índice do objeto especificado CodeStatement no CodeStatementCollection, se este existir na coleção.

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

Parâmetros

value
CodeStatement

A CodeStatement localizar na coleção.

Devoluções

O índice do objeto especificado, se for encontrado, na coleção; caso contrário, -1.

Exemplos

O exemplo seguinte procura a presença de um específico CodeStatement e utiliza o IndexOf método para recuperar o valor do índice em que foi encontrado.

// Tests for the presence of a CodeStatement in the
// collection, and retrieves its index if it is found.
int itemIndex = -1;
if( collection.Contains( testStatement ) )
    itemIndex = collection.IndexOf( testStatement );
' Tests for the presence of a CodeStatement in the 
' collection, and retrieves its index if it is found.
Dim itemIndex As Integer = -1
If collection.Contains(testStatement) Then
    itemIndex = collection.IndexOf(testStatement)
End If

Aplica-se a

Ver também