问题描述
是否可以将哈希表另存为应用程序设置?
我可以将一个字符串(一个StringCollection)保存为应用程序设置,但不能对许多其他类型(例如HashTable,object)执行相同的操作.我这样编码:
Settings.Default.Users =新的HashTable();
Settings.Default.Users.Add(用户名,密码);
Settings.Default.Save();
它应该保存一对键和值,但事实并非如此.
每次应用启动时,Settings.Default.Users都会为null.
您能告诉我如何保存吗?请不要引导我使用任何不使用HashTable来保存键和值对的解决方案.我只想使用HashTable.
非常感谢!
Could you please let me know if saving a hashtable as app setting is possible?
I can save a string, a StringCollection as app settings but can''t do the same to many other types such as HashTable, object. I coded like this:
Settings.Default.Users = new HashTable();
Settings.Default.Users.Add(username, password);
Settings.Default.Save();
It should save the pair of key and value but it doesn''t.
Each time the app starts that Settings.Default.Users becomes null.
Could you please show me how to save it? Please don''t lead me to any solution for saving a pair of key and value without using HashTable. I want to use HashTable only.
Thank you very much!
推荐答案
这篇关于无法将HashTable,对象...保存为应用程序设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!