Values 속성은 Hashtable의 값을 포함하는 ICollection을 가져옵니다.
Hashtable 컬렉션 선언 -
Hashtable ht = new Hashtable();
이제 값 추가
ht.Add("One", "Henry");
ht.Add("Two", "Kevin");
ht.Add("Three", "David"); Hashtable의 값을 표시하기 위한 코드는 다음과 같습니다. -
예시
using System;
using System.Collections;
namespace Demo {
class Program {
static void Main(string[] args) {
Hashtable ht = new Hashtable();
ht.Add("One", "Henry");
ht.Add("Two", "Kevin");
ht.Add("Three", "David");
// Displaying values
foreach (string value in ht.Values) {
Console.WriteLine(value);
}
Console.ReadKey();
}
}
} 출력
David Henry Kevin