StringDictionary.Values Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém uma coleção de valores no 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 Propriedade
E ICollection que fornece os valores no StringDictionary.
Exemplos
O seguinte exemplo de código enumera os elementos de um 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
Observações
A ordem dos valores em o ICollection não é especificada, mas é a mesma ordem das chaves associadas em o ICollection devolvido Keys pelo método.
O retornado ICollection não é uma cópia estática; em vez disso, o ICollection refere-se aos valores no original StringDictionary. Portanto, as alterações ao StringDictionary continuam a ser refletidas no ICollection.
Recuperar o valor desta propriedade é uma operação O(1).