CodeNamespaceCollection.IndexOf(CodeNamespace) 메서드

정의

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

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

매개 변수

value
CodeNamespace

찾을 위치입니다 CodeNamespace .

반품

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

예제

다음 예제에서는 특정 CodeNamespace 항목이 있는지 검색하고 메서드를 IndexOf 사용하여 검색된 인덱스 값을 검색합니다.

// Tests for the presence of a CodeNamespace in the collection,
// and retrieves its index if it is found.
CodeNamespace testNamespace = new CodeNamespace("TestNamespace");
int itemIndex = -1;
if( collection.Contains( testNamespace ) )
    itemIndex = collection.IndexOf( testNamespace );
' Tests for the presence of a CodeNamespace in the collection,
' and retrieves its index if it is found.
Dim testNamespace As New CodeNamespace("TestNamespace")
Dim itemIndex As Integer = -1
If collection.Contains(testNamespace) Then
    itemIndex = collection.IndexOf(testNamespace)
End If

적용 대상

추가 정보