CodeExpressionCollection.Contains(CodeExpression) メソッド

定義

コレクションに指定した 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

適用対象

こちらもご覧ください