Condividi tramite


CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) Metodo

Definizione

Ottiene l'indice dell'oggetto CodeTypeDeclaration specificato in CodeTypeDeclarationCollection, se esistente.

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

Parametri

value
CodeTypeDeclaration

Oggetto CodeTypeDeclaration da individuare nella raccolta.

Restituisce

Indice dell'oggetto specificato, se trovato nell'insieme, in caso contrario -1.

Esempio

Nell'esempio IndexOf seguente vengono recuperate CodeTypeDeclaration voci da un CodeTypeDeclarationCollection oggetto e vengono visualizzati i nomi e gli indici restituiti dal metodo .

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

Si applica a

Vedi anche