CodeNamespaceCollection.IndexOf(CodeNamespace) Metoda

Definice

Získá index zadaného CodeNamespace objektu CodeNamespaceCollectionv , pokud existuje v kolekci.

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

Parametry

value
CodeNamespace

Vyhledá CodeNamespace se.

Návraty

Index zadaného CodeNamespaceobjektu , pokud je nalezen, v kolekci; v opačném případě hodnota -1.

Příklady

Následující příklad vyhledá přítomnost konkrétního CodeNamespace a použije metodu IndexOf k načtení hodnoty indexu, na které byla nalezena.

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

Platí pro

Viz také