CodeAttributeArgumentCollection.IndexOf(CodeAttributeArgument) 메서드

정의

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

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

매개 변수

value
CodeAttributeArgument

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

반환

Int32

지정된 개체가 컬렉션에 있으면 해당 인덱스이고, 그렇지 않으면 -1입니다.

예제

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

// Tests for the presence of a CodeAttributeArgument 
// within the collection, and retrieves its index if it is found.
CodeAttributeArgument^ testArgument = gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) );
int itemIndex = -1;
if ( collection->Contains( testArgument ) )
   itemIndex = collection->IndexOf( testArgument );
// Tests for the presence of a CodeAttributeArgument
// within the collection, and retrieves its index if it is found.
CodeAttributeArgument testArgument = new CodeAttributeArgument("Test Boolean Argument", new CodePrimitiveExpression(true));
int itemIndex = -1;
if( collection.Contains( testArgument ) )
    itemIndex = collection.IndexOf( testArgument );
' Tests for the presence of a CodeAttributeArgument in 
' the collection, and retrieves its index if it is found.
Dim testArgument As New CodeAttributeArgument("Test Boolean Argument", New CodePrimitiveExpression(True))
Dim itemIndex As Integer = -1
If collection.Contains(testArgument) Then
    itemIndex = collection.IndexOf(testArgument)
End If

적용 대상

추가 정보