CodeNamespaceCollection.IndexOf(CodeNamespace) Metodo

Definizione

Ottiene l'indice dell'oggetto specificato CodeNamespace nell'oggetto CodeNamespaceCollection, se presente nell'insieme.

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

Parametri

value
CodeNamespace

Oggetto CodeNamespace da individuare.

Valori restituiti

Indice dell'oggetto specificato CodeNamespace, se presente, nell'insieme; in caso contrario, -1.

Esempio

Nell'esempio seguente viene eseguita la ricerca della presenza di un oggetto specifico CodeNamespace e viene utilizzato il IndexOf metodo per recuperare il valore di indice in corrispondenza del quale è stato trovato.

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

Si applica a

Vedi anche