CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) Methode

Definition

Ruft den Index des angegebenen CodeTypeDeclaration-Objekts in der CodeTypeDeclarationCollection ab, sofern dieses in der Auflistung vorhanden ist.

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

Parameter

value
CodeTypeDeclaration

Die CodeTypeDeclaration, die in der Auflistung gesucht werden soll.

Gibt zurück

Der Index der angegebenen Objekts, wenn sich dieses in der Auflistung befindet, andernfalls -1.

Beispiele

Im folgenden Beispiel werden Einträge aus einem CodeTypeDeclarationCollection -Objekt abgerufen CodeTypeDeclaration und deren Namen und Indizes angezeigt, die von der IndexOf -Methode zurückgegeben werden.

// Tests for the presence of a CodeTypeDeclaration in the 
// collection, and retrieves its index if it is found.
CodeTypeDeclaration^ testDeclaration = gcnew CodeTypeDeclaration( "TestType" );
int itemIndex = -1;
if ( collection->Contains( testDeclaration ) )
   itemIndex = collection->IndexOf( testDeclaration );
// Tests for the presence of a CodeTypeDeclaration in the
// collection, and retrieves its index if it is found.
CodeTypeDeclaration testDeclaration = new CodeTypeDeclaration("TestType");
int itemIndex = -1;
if( collection.Contains( testDeclaration ) )
    itemIndex = collection.IndexOf( testDeclaration );
' Tests for the presence of a CodeTypeDeclaration in the 
' collection, and retrieves its index if it is found.
Dim testDeclaration As New CodeTypeDeclaration("TestType")
Dim itemIndex As Integer = -1
If collection.Contains(testDeclaration) Then
    itemIndex = collection.IndexOf(testDeclaration)
End If

Gilt für:

Weitere Informationen