Share via


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

適用対象

こちらもご覧ください