CodeStatementCollection.IndexOf(CodeStatement) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
コレクション内に存在する場合は、CodeStatementCollection内の指定したCodeStatement オブジェクトのインデックスを取得します。
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
パラメーター
- value
- CodeStatement
コレクション内で検索する CodeStatement 。
返品
指定したオブジェクトが見つかった場合は、コレクション内のインデックス。それ以外の場合は -1。
例
次の例では、特定の CodeStatement の存在を検索し、 IndexOf メソッドを使用して、検出されたインデックス値を取得します。
// 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