IDictionary<TKey,TValue>.Values Свойство

Определение

Возвращает интерфейс ICollection<T>, содержащий значения из IDictionary<TKey,TValue>.

public:
 property System::Collections::Generic::ICollection<TValue> ^ Values { System::Collections::Generic::ICollection<TValue> ^ get(); };
public System.Collections.Generic.ICollection<TValue> Values { get; }
member this.Values : System.Collections.Generic.ICollection<'Value>
Public ReadOnly Property Values As ICollection(Of TValue)

Значение свойства

ICollection<TValue>

Интерфейс ICollection<T>, содержащий значения объекта, который реализует IDictionary<TKey,TValue>.

Примеры

В следующем примере кода показано, как перечислить значения только с помощью Values свойства .

Этот код является частью более крупного примера, который можно компилировать и выполнять. См. раздел System.Collections.Generic.IDictionary<TKey,TValue>.

// To get the values alone, use the Values property.
ICollection<String^>^ icoll = openWith->Values;

// The elements of the ValueCollection are strongly typed
// with the type that was specified for dictionary values.
Console::WriteLine();
for each( String^ s in icoll )
{
    Console::WriteLine("Value = {0}", s);
}
// To get the values alone, use the Values property.
ICollection<string> icoll = openWith.Values;

// The elements of the ValueCollection are strongly typed
// with the type that was specified for dictionary values.
Console.WriteLine();
foreach( string s in icoll )
{
    Console.WriteLine("Value = {0}", s);
}
' To get the values alone, use the Values property.
Dim icoll As ICollection(Of String) = openWith.Values

' The elements of the ValueCollection are strongly typed
' with the type that was specified for dictionary values.
Console.WriteLine()
For Each s As String In  icoll
    Console.WriteLine("Value = {0}", s)
Next s

Комментарии

Порядок значений в возвращаемом ICollection<T> объекте не указан, но он гарантированно будет иметь тот же порядок, что и соответствующие ключи в объекте ICollection<T> , возвращаемом свойством Keys .

Применяется к

См. также раздел