다음을 통해 공유


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 = gcnew 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.
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

적용 대상

추가 정보