CodeExpressionCollection.Contains(CodeExpression) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个值,该值指示集合是否包含指定的 CodeExpression 对象。
public:
bool Contains(System::CodeDom::CodeExpression ^ value);
public bool Contains(System.CodeDom.CodeExpression value);
member this.Contains : System.CodeDom.CodeExpression -> bool
Public Function Contains (value As CodeExpression) As Boolean
参数
- value
- CodeExpression
要 CodeExpression 定位在集合中的对象。
返回
true 如果集合包含指定的对象,则为 ;否则,为 false.
示例
下面的示例使用 Contains 该方法搜索特定 CodeExpression 对象的存在,并获取找到它的索引值。
// Tests for the presence of a CodeExpression in the
// collection, and retrieves its index if it is found.
CodeExpression testComment = new CodePrimitiveExpression(true);
int itemIndex = -1;
if( collection.Contains( testComment ) )
itemIndex = collection.IndexOf( testComment );
' Tests for the presence of a CodeExpression in the
' collection, and retrieves its index if it is found.
Dim testComment = New CodePrimitiveExpression(True)
Dim itemIndex As Integer = -1
If collection.Contains(testComment) Then
itemIndex = collection.IndexOf(testComment)
End If