CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar indexet för det angivna CodeTypeDeclaration objektet i CodeTypeDeclarationCollection, om det finns i samlingen.
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
Parametrar
- value
- CodeTypeDeclaration
Att CodeTypeDeclaration hitta i samlingen.
Returer
Indexet för det angivna objektet, om det hittas, i samlingen; annars -1.
Exempel
I följande exempel hämtas CodeTypeDeclaration poster från ett CodeTypeDeclarationCollection objekt och deras namn och index som returneras av IndexOf metoden visas.
// 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