CodeStatementCollection.Contains(CodeStatement) 方法

定义

获取一个值,该值指示集合是否包含指定的 CodeStatement 对象。

public:
 bool Contains(System::CodeDom::CodeStatement ^ value);
public bool Contains (System.CodeDom.CodeStatement value);
member this.Contains : System.CodeDom.CodeStatement -> bool
Public Function Contains (value As CodeStatement) As Boolean

参数

value
CodeStatement

要在此集合中搜索的 CodeStatement 对象。

返回

当集合包含指定的对象时为 true;否则为 false

示例

以下示例使用 Contains 方法搜索特定 CodeStatement 是否存在,并检索找到它的索引值。

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

适用于

另请参阅