다음을 통해 공유


CodeAttributeDeclarationCollection.Contains(CodeAttributeDeclaration) 메서드

정의

컬렉션에 지정된 CodeAttributeDeclaration 개체가 들어 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

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

매개 변수

value
CodeAttributeDeclaration

찾을 CodeAttributeDeclaration 개체입니다.

반환

컬렉션에 지정한 개체가 포함되어 있으면 true이고, 그렇지 않으면 false입니다.

예제

다음 예제에서는 메서드를 Contains 사용하여 특정 CodeAttributeDeclaration instance 있는지 검색하고 발견된 인덱스 값을 가져옵니다.

// Tests for the presence of a CodeAttributeDeclaration in 
// the collection, and retrieves its index if it is found.
array<CodeAttributeArgument^>^temp3 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
CodeAttributeDeclaration^ testdeclaration = gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp3 );
int itemIndex = -1;
if ( collection->Contains( testdeclaration ) )
   itemIndex = collection->IndexOf( testdeclaration );
// Tests for the presence of a CodeAttributeDeclaration in
// the collection, and retrieves its index if it is found.
CodeAttributeDeclaration testdeclaration = new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description")) );
int itemIndex = -1;
if( collection.Contains( testdeclaration ) )
    itemIndex = collection.IndexOf( testdeclaration );
' Tests for the presence of a CodeAttributeDeclaration in the 
' collection, and retrieves its index if it is found.
Dim testdeclaration As New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description")))
Dim itemIndex As Integer = -1
If collection.Contains(testdeclaration) Then
    itemIndex = collection.IndexOf(testdeclaration)
End If

적용 대상

추가 정보