CodeCommentStatementCollection.IndexOf(CodeCommentStatement) Método

Definición

Obtiene el índice del objeto especificado CodeCommentStatement en la colección, si existe en la colección.

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

Parámetros

value
CodeCommentStatement

Objeto CodeCommentStatement que se va a buscar.

Devoluciones

Índice del objeto especificado, si se encuentra, en la colección; de lo contrario, -1.

Ejemplos

En el ejemplo siguiente se busca la presencia de un objeto específico CodeCommentStatement y se usa el IndexOf método para obtener el valor de índice en el que se encontró.

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

Se aplica a

Consulte también