CodeStatementCollection.IndexOf(CodeStatement) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取集合中CodeStatement指定CodeStatementCollection对象的索引(如果该对象存在于集合中)。
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