CodeCatchClauseCollection.Contains(CodeCatchClause) 方法

定义

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

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

参数

value
CodeCatchClause

要在集合中定位的 CodeCatchClause 对象。

返回

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

示例

以下示例使用 Contains 方法搜索特定 CodeCatchClause 实例的存在,并获取找到该实例的索引值。

// Tests for the presence of a CodeCatchClause in the 
// collection, and retrieves its index if it is found.
CodeCatchClause^ testClause = gcnew CodeCatchClause( "e" );
int itemIndex = -1;
if ( collection->Contains( testClause ) )
   itemIndex = collection->IndexOf( testClause );
// Tests for the presence of a CodeCatchClause in the
// collection, and retrieves its index if it is found.
CodeCatchClause testClause = new CodeCatchClause("e");
int itemIndex = -1;
if( collection.Contains( testClause ) )
    itemIndex = collection.IndexOf( testClause );
' Tests for the presence of a CodeCatchClause in the 
' collection, and retrieves its index if it is found.
Dim testClause As New CodeCatchClause("e")
Dim itemIndex As Integer = -1
If collection.Contains(testClause) Then
    itemIndex = collection.IndexOf(testClause)
End If

适用于

另请参阅