CodeAttributeDeclarationCollection.IndexOf(CodeAttributeDeclaration) 메서드

정의

컬렉션에 있는 경우 컬렉션에 지정된 CodeAttributeDeclaration 개체의 인덱스를 가져옵니다.

public:
 int IndexOf(System::CodeDom::CodeAttributeDeclaration ^ value);
public int IndexOf(System.CodeDom.CodeAttributeDeclaration value);
member this.IndexOf : System.CodeDom.CodeAttributeDeclaration -> int
Public Function IndexOf (value As CodeAttributeDeclaration) As Integer

매개 변수

value
CodeAttributeDeclaration

CodeAttributeDeclaration 컬렉션에서 찾을 개체입니다.

반품

지정된 개체의 컬렉션에 있는 인덱스입니다(있는 경우). 그렇지 않으면 -1입니다.

예제

다음 예제에서는 특정 CodeAttributeDeclaration 인스턴스의 존재를 검색하고 메서드를 IndexOf 사용하여 발견된 인덱스 값을 가져옵니다.

// 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

적용 대상

추가 정보