CodeCommentStatementCollection.Contains(CodeCommentStatement) メソッド

定義

指定した CodeCommentStatement オブジェクトがコレクションに含まれているかどうかを示す値を取得します。

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

パラメーター

value
CodeCommentStatement

コレクション内で検索される CodeCommentStatement

戻り値

コレクションに指定したオブジェクトが格納されている場合は true。それ以外の場合は false

次の例では、 メソッドを Contains 使用して特定 CodeCommentStatement のオブジェクトの存在を検索し、検出されたインデックス値を取得します。

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

適用対象

こちらもご覧ください