存储字典<string,string>在应用程序设置中 [英] Store Dictionary&lt;string,string&gt; in application settings

查看:42
本文介绍了存储字典<string,string>在应用程序设置中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字符串字典,我希望用户能够添加/删除信息,然后为他们存储它,以便他们可以在下次程序重新启动时访问它

I have a dictionary of strings that i want the user to be able to add/remove info from then store it for them so it they can access it the next time the program restarts

我不清楚如何将字典存储为设置.我看到在 system.collections.special 下有一个叫做 stringdictionary 的东西,但我读到 SD 已经过时,不应该使用.

I am unclear on how i can store a dictionary as a setting. I see that under system.collections.special there is a thing called a stringdictionary but ive read that SD are outdated and shouldn't be used.

将来我可能还需要存储一个不只是字符串的字典(int string)

also in the future i may have need to store a dictionary that is not strings only (int string)

如何在 .net 应用程序的设置文件中存储字典?

how would you store a dictionary in the settings file for a .net application?

推荐答案

最简单的答案是使用一行 &列分隔符将您的字典转换为单个字符串.然后你只需要在设置文件中存储 1 个字符串.

The simplest answer would be to use a row & column delimiter to convert your dictionary to a single string. Then you just need to store 1 string in the settings file.

这篇关于存储字典<string,string>在应用程序设置中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆