IDictionary<TKey,TValue>.Values IDictionary<TKey,TValue>.Values IDictionary<TKey,TValue>.Values IDictionary<TKey,TValue>.Values Property

定義

取得 ICollection<T>,包含 IDictionary<TKey,TValue> 中的值。Gets an ICollection<T> containing the values in the 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> 之物件中的值。An ICollection<T> containing the values in the object that implements IDictionary<TKey,TValue>.

範例

下列程式碼範例示範如何列舉值單獨使用Values屬性。The following code example shows how to enumerate values alone using the Values property.

此程式碼是大型的編譯和執行範例的一部分。This code is part of a larger example that can be compiled and executed. 請參閱 System.Collections.Generic.IDictionary<TKey,TValue>See 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屬性。The order of the values in the returned ICollection<T> is unspecified, but it is guaranteed to be the same order as the corresponding keys in the ICollection<T> returned by the Keys property.

適用於

另請參閱