Values प्रॉपर्टी को एक ICollection मिलता है जिसमें हैशटेबल में मान होते हैं।
हैशटेबल संग्रह घोषित करें -
Hashtable ht = new Hashtable();
अब मान जोड़ें
ht.Add("One", "Henry");
ht.Add("Two", "Kevin");
ht.Add("Three", "David"); हैशटेबल से मान प्रदर्शित करने के लिए, निम्नलिखित कोड है -
उदाहरण
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