CodeNamespaceCollection.IndexOf(CodeNamespace) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the index of the specified CodeNamespace object in the CodeNamespaceCollection, if it exists in the collection.
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
Parameters
- value
- CodeNamespace
The CodeNamespace to locate.
Returns
The index of the specified CodeNamespace, if it is found, in the collection; otherwise, -1.
Examples
The following example searches for the presence of a specific CodeNamespace and uses the IndexOf method to retrieve the index value at which it was found.
// Tests for the presence of a CodeNamespace in the collection,
// and retrieves its index if it is found.
CodeNamespace^ testNamespace = gcnew 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.
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
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET