Create a Hashtable from a dictionary in CSharp
Description
The following code shows how to create a Hashtable from a dictionary.
Example
using System;// w ww.jav a 2 s .co m
using System.Collections;
using System.Globalization;
public class SamplesHashtable
{
public static void Main()
{
SortedList mySL = new SortedList();
mySL.Add("FIRST", "Hello");
Hashtable myHT1 = new Hashtable(mySL);
foreach (string firstName in myHT1.Keys)
{
Console.WriteLine("{0} {1}", firstName, myHT1[firstName]);
}
}
}
The code above generates the following result.