I have solved it by following.
Is there any other solution?
class Program
{
static void Main(string[] args)
{
Hashtable hsTbl = new Hashtable();
hsTbl.Add(1, "Suhas");
hsTbl.Add(2, "Madhuri");
hsTbl.Add(3, "Om");
List
Console.WriteLine("Key Value");
foreach (DictionaryEntry item in hsTbl)
{
Console.WriteLine(item.Key + " " + item.Value);
keyList.Add(item.Value);
ValList.Add(item.Key);
}
hsTbl.Clear()
//Swapping
for (int i = 0; i < keyList.Count; i++)
{
hsTbl.Add(keyList[i], ValList[i]);
}
//will display hashtable after swapping
foreach (DictionaryEntry item in hsTbl)
{
Console.WriteLine(item.Key + " " + item.Value);
}
}
}

VulpesPosted Jan 16, 2013, 11:13 AM
Note that, in general, no method is guaranteed to work because some of the values in the original hashtable may be duplicated and therefore be unsuitable as keys.
Suhas DPosted Jan 17, 2013, 11:46 PM
@Santhosh Kumar : Your approch is also right but I did want to create new Hashtable for this.
Santhosh Kumar JayaramanPosted Jan 16, 2013, 2:13 AM