CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) Metoda

Definice

Získá index zadaného CodeTypeDeclaration objektu CodeTypeDeclarationCollectionv , pokud existuje v kolekci.

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

Parametry

value
CodeTypeDeclaration

k CodeTypeDeclaration vyhledání v kolekci.

Návraty

Index zadaného objektu, pokud je nalezen, v kolekci; jinak hodnota -1.

Příklady

Následující příklad načte CodeTypeDeclaration položky z objektu CodeTypeDeclarationCollection a zobrazí jejich názvy a indexy vrácené metodou IndexOf .

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

Platí pro

Viz také