Dictionary.Values 속성
.NET Framework 3.0
Dictionary의 값을 포함하는 컬렉션을 가져옵니다.
네임스페이스: System.Collections.Generic
어셈블리: mscorlib(mscorlib.dll)
어셈블리: mscorlib(mscorlib.dll)
Dictionary.ValueCollection의 값 순서는 지정되어 있지 않지만 Keys 속성에서 반환하는 Dictionary.KeyCollection의 관련 키와 같은 순서로 정렬됩니다.
반환된 Dictionary.ValueCollection은 정적 복사본이 아닙니다. 대신, Dictionary.ValueCollection은 원래 Dictionary의 값을 다시 참조합니다. 따라서 Dictionary을 변경하면 Dictionary.ValueCollection에 계속 반영됩니다.
이 속성의 값을 가져오는 것은 O(1) 연산입니다.
이 코드 예제에서는 Values 속성을 사용하여 사전에 있는 값을 열거하는 방법과 사전에 있는 키와 값을 열거하는 방법을 보여 줍니다.
이 코드 예제는 Dictionary 클래스에 대해 제공되는 보다 큰 예제의 일부입니다.
// To get the values alone, use the Values property.
Dictionary<string, string>.ValueCollection valueColl =
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 valueColl )
{
Console.WriteLine("Value = {0}", s);
}
...
// When you use foreach to enumerate dictionary elements,
// the elements are retrieved as KeyValuePair objects.
Console.WriteLine();
foreach( KeyValuePair<string, string> kvp in openWith )
{
Console.WriteLine("Key = {0}, Value = {1}",
kvp.Key, kvp.Value);
}
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
Microsoft .NET Framework 3.0은 Windows Vista, Microsoft Windows XP SP2 및 Windows Server 2003 SP1에서 지원됩니다.