![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the Values property of Hashtable class in C#?
The Values property gets an ICollection containing the values in the Hashtable.
Declare Hashtable collection −
Hashtable ht = new Hashtable();
Now add values
ht.Add("One", "Henry"); ht.Add("Two", "Kevin"); ht.Add("Three", "David");
To display values from Hashtable, the following is the code −
Example
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(); } } }
Output
David Henry Kevin
Advertisements