IDictionary<TKey,TValue>.Values 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得 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>對應索引鍵的順序相同。