CodeCatchClauseCollection.Contains(CodeCatchClause) 方法

定义

获取一个值,该值指示集合是否包含指定的 CodeCatchClause 对象。Gets a value that indicates whether the collection contains the specified CodeCatchClause object.

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 对象。The CodeCatchClause object to locate in the collection.

返回

Boolean

当集合包含指定的对象时为 true;否则为 falsetrue if the collection contains the specified object; otherwise, false.

示例

下面的示例使用 Contains 方法搜索某个特定实例的状态 CodeCatchClause ,并获取找到该实例的索引值。The following example uses the Contains method to search for the presence of a specific CodeCatchClause instance and gets the index value at which it was found.

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

适用于

另请参阅