Compartilhar via


CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) Método

Definição

Obtém o índice do objeto CodeTypeDeclaration na CodeTypeDeclarationCollection, se ele existe na coleção.

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

Parâmetros

value
CodeTypeDeclaration

O CodeTypeDeclaration a ser localizado na coleção.

Retornos

O índice do objeto especificado, se encontrado, na coleção; caso contrário, -1.

Exemplos

O exemplo a IndexOf seguir recupera entradas CodeTypeDeclaration de um CodeTypeDeclarationCollection objeto e exibe seus nomes e índices retornados pelo método .

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

Aplica-se a

Confira também