StringDictionary.Values Propiedad

Definición

Obtiene una colección de valores de .StringDictionary

public:
 virtual property System::Collections::ICollection ^ Values { System::Collections::ICollection ^ get(); };
public virtual System.Collections.ICollection Values { get; }
member this.Values : System.Collections.ICollection
Public Overridable ReadOnly Property Values As ICollection

Valor de propiedad

que ICollection proporciona los valores de .StringDictionary

Ejemplos

En el ejemplo de código siguiente se enumeran los elementos de .StringDictionary

using System;
using System.Collections;
using System.Collections.Specialized;

public class SamplesStringDictionary
{
    public static void Main()
    {
        // Creates and initializes a new StringDictionary.
        StringDictionary myCol = new StringDictionary();
        myCol.Add( "red", "rojo" );
        myCol.Add( "green", "verde" );
        myCol.Add( "blue", "azul" );

        Console.WriteLine("VALUES");
        foreach (string val in myCol.Values)
        {
            Console.WriteLine(val);
        }
    }
}
// This code produces the following output.
// VALUES
// verde
// rojo
// azul
Imports System.Collections
Imports System.Collections.Specialized

Public Class SamplesStringDictionary
    Public Shared Sub Main()
        ' Creates and initializes a new StringDictionary.
        Dim myCol As New StringDictionary()
        myCol.Add( "red", "rojo" )
        myCol.Add( "green", "verde" )
        myCol.Add( "blue", "azul" )

        Console.WriteLine("VALUES")
        For Each val As String In myCol.Values
            Console.WriteLine(val)
        Next val
    End Sub
End Class

' This code produces the following output.
'
' VALUES
' verde
' rojo
' azul

Comentarios

El orden de los valores de no ICollection se especifica, pero es el mismo orden que las claves asociadas en el ICollection devuelto por el Keys método .

El devuelto ICollection no es una copia estática; en su lugar, ICollection hace referencia a los valores del objeto original StringDictionary. Por lo tanto, los cambios en el StringDictionary objeto continúan reflejados en .ICollection

Recuperar el valor de esta propiedad es una operación O(1).

Se aplica a