Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am creating an xml file that stores the values of GUI elements as key,value pairs. I am attaching the code snippet that I am using private static Hashtable appSettings;

static ConfigurationManager()
{
appSettings = new Hashtable();

}
public static void SetAppSetting(string key, string value)
{
appSettings[key] = value;
}
Before writing to the xml file, I am populating the appsettings Hashtable, from the GUI as below:

ConfigurationManager.SetAppSetting("A1", m_chkA1.Checked.ToString());
ConfigurationManager.SetAppSetting("A2", m_chkA2.Checked.ToString());// ? 1 : 0;
ConfigurationManager.SetAppSetting("A3", m_chkA3.Checked.ToString());// ? 1 : 0;
and then I write to the xml file. When I check the appSettings list, it shows in the below order. + ["A3"] "True"
+ ["A1"] "True"
+ ["A2"] "True"

I see that this is organized based on the hash code of the key but how do I arrange in the same order that I save ? Please suggest.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900