CodeCommentStatementCollection.IndexOf(CodeCommentStatement) Metodo

Definizione

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

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

Parametri

value
CodeCommentStatement

Oggetto CodeCommentStatement da individuare.

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 CodeCommentStatement e viene utilizzato il IndexOf metodo per ottenere il valore di indice in corrispondenza del quale è stato trovato.

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

Si applica a

Vedi anche