Freigeben über


CodeCommentStatementCollection.IndexOf-Methode

Ruft den Index in der Auflistung des angegebenen CodeCommentStatement ab, sofern es in der Auflistung vorhanden ist.

Namespace: System.CodeDom
Assembly: System (in system.dll)

Syntax

'Declaration
Public Function IndexOf ( _
    value As CodeCommentStatement _
) As Integer
'Usage
Dim instance As CodeCommentStatementCollection
Dim value As CodeCommentStatement
Dim returnValue As Integer

returnValue = instance.IndexOf(value)
public int IndexOf (
    CodeCommentStatement value
)
public:
int IndexOf (
    CodeCommentStatement^ value
)
public int IndexOf (
    CodeCommentStatement value
)
public function IndexOf (
    value : CodeCommentStatement
) : int

Parameter

Rückgabewert

Der Index des angegebenen CodeCommentStatement in der Auflistung, sofern dieses gefunden wird, andernfalls -1.

Beispiel

' 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
// 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.
CodeCommentStatement^ testComment = gcnew 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.
CodeCommentStatement testComment = new 
    CodeCommentStatement("Test comment");
int itemIndex = -1;
if (collection.Contains(testComment)) {
    itemIndex = collection.IndexOf(testComment);
}

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

CodeCommentStatementCollection-Klasse
CodeCommentStatementCollection-Member
System.CodeDom-Namespace
Contains