StringDictionary.Values Propriedade
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
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 da propriedade
Um ICollection que fornece os valores na StringDictionary.
Exemplos
O exemplo de código a seguir 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
Comentários
A ordem dos valores no ICollection não é especificada, mas é a mesma ordem que as chaves associadas no ICollection método retornado Keys .
O retornado ICollection não é uma cópia estática; em vez disso, ele ICollection faz referência aos valores no original StringDictionary. Portanto, as alterações na continuação StringDictionary a serem refletidas no ICollection.
Recuperar o valor dessa propriedade é uma operação O(1).