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> 的值順序未指定,但保證與 屬性所 Keys 傳回之 中 ICollection<T> 對應索引鍵的順序相同。

適用於

另請參閱