In hashtabesclass, using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
namespace HashTable
{
class hashtabes
{
Hashtable ht = new Hashtable();
public string setting()
{
for (int i = 0; i < 5; i++)
{
Console.WriteLine("Enetr the Key");
string key = Console.ReadLine();
Console.WriteLine("Enter the Value");
string value = Console.ReadLine();
ht.Add(key, value);
}
}
public string Getting()
{
Console.WriteLine("Please enter the Key");
string input = Console.ReadLine();
Console.WriteLine(ht[input]);
}
}
}
In Main Program, using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
namespace HashTable
{
class Program
{
static void Main(string[] args)
{
hashtabes obj = new hashtabes();
obj.setting();
obj.Getting();
Console.ReadLine();
}
}
}