CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) Methode

Definitie

Hiermee haalt u de index op van het opgegeven CodeTypeDeclaration object in de CodeTypeDeclarationCollectionverzameling, als het in de verzameling bestaat.

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

Parameters

value
CodeTypeDeclaration

De CodeTypeDeclaration te vinden in de verzameling.

Retouren

De index van het opgegeven object, indien gevonden, in de verzameling; anders, -1.

Voorbeelden

In het volgende voorbeeld worden vermeldingen CodeTypeDeclaration opgehaald uit een CodeTypeDeclarationCollection object en worden hun namen en indexen weergegeven die door de IndexOf methode worden geretourneerd.

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

Van toepassing op

Zie ook