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");
// वैल्यूज़ डिस्प्ले कर रहे हैं
foreach (string value in ht.Values) {
Console.WriteLine(value);
}
Console.ReadKey();
}
}
}
आउटपुट
David Henry Kevin