hashtable or Dictionary!
-
If I want to save the user setting and permissions and my system parameters for the application public use (in C#)... what's the best way to do it? hashtable or dictionary? or maybe another way?! Thanks....
-
If I want to save the user setting and permissions and my system parameters for the application public use (in C#)... what's the best way to do it? hashtable or dictionary? or maybe another way?! Thanks....
-
If I want to save the user setting and permissions and my system parameters for the application public use (in C#)... what's the best way to do it? hashtable or dictionary? or maybe another way?! Thanks....
- Dictionary uses a hashtable. 1) Are your settings all one datatype?
-
If I want to save the user setting and permissions and my system parameters for the application public use (in C#)... what's the best way to do it? hashtable or dictionary? or maybe another way?! Thanks....
-
- Dictionary uses a hashtable. 1) Are your settings all one datatype?
One thing to remind, if you try to save settings in either of the data structures as a xml file then you are out of luck, by default both of them are not serializable. You have to implement the IXmlSerializable interface in a custom object and wrap it around the hash table.
Regards, Anindya Chatterjee[^]
-
One thing to remind, if you try to save settings in either of the data structures as a xml file then you are out of luck, by default both of them are not serializable. You have to implement the IXmlSerializable interface in a custom object and wrap it around the hash table.
Regards, Anindya Chatterjee[^]
So what?
-
I am not sure why you would use a hashtable or dictionary. There is the Settings.Settings for just that purpose. Unless I am not understanding your question.
ASCII stupid question, get a stupid ANSI
I forgot to say al the parameters are saved in SQL server and it will be populated into hashtable, dictionary or whatever your recommendation is so that I don't need to connect to the database every timeto read a single value.
-
- Dictionary uses a hashtable. 1) Are your settings all one datatype?
not all one type but in worst case I can save all as string and convert within the application
-
If you want to save user settings, you can use Settings or create custom tags in the configuration file. Then you can read them from the configuration file when the application is loaded.
do you have an example of doing this (hashtable or dictionary) in a public class and use it across the application?
-
I forgot to say al the parameters are saved in SQL server and it will be populated into hashtable, dictionary or whatever your recommendation is so that I don't need to connect to the database every timeto read a single value.
It is a simple question of object type then. If your key is consistent (e.g. UserID as a string, or a custom UserID object) as well as your containing values you should deffinately use a dictionary for performence and your own sanity. If these objects vary then you are stuck with the hash table. A Dictionary is a hashtable with generics, i.e. no casting is necessary which is a performance gain and will avoid incorrect casting that can cause run time errors.
ASCII stupid question, get a stupid ANSI
-
If I want to save the user setting and permissions and my system parameters for the application public use (in C#)... what's the best way to do it? hashtable or dictionary? or maybe another way?! Thanks....
Ah, so you're still asking about these: http://www.codeproject.com/Messages/3432325/create-public-variables-at-run-time.aspx[^] http://www.codeproject.com/Forums/1649/Csharp.aspx?fid=1649&tid=3429896[^]