CodeStatementCollection.IndexOf(CodeStatement) Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Získá index zadaného CodeStatement objektu CodeStatementCollectionv , pokud existuje v kolekci.
public:
int IndexOf(System::CodeDom::CodeStatement ^ value);
public int IndexOf(System.CodeDom.CodeStatement value);
member this.IndexOf : System.CodeDom.CodeStatement -> int
Public Function IndexOf (value As CodeStatement) As Integer
Parametry
- value
- CodeStatement
Vyhledání CodeStatement v kolekci.
Návraty
Index zadaného objektu, pokud je nalezen, v kolekci; jinak, -1.
Příklady
Následující příklad vyhledá přítomnost konkrétního CodeStatement a pomocí IndexOf metody načte hodnotu indexu, na které byla nalezena.
// Tests for the presence of a CodeStatement in the
// collection, and retrieves its index if it is found.
int itemIndex = -1;
if( collection.Contains( testStatement ) )
itemIndex = collection.IndexOf( testStatement );
' Tests for the presence of a CodeStatement in the
' collection, and retrieves its index if it is found.
Dim itemIndex As Integer = -1
If collection.Contains(testStatement) Then
itemIndex = collection.IndexOf(testStatement)
End If