我想在我的appSettings中存储一维字符串数组作为条目。我不能简单地用…分开元素,或者因为元素本身可以包含这些字符。
我正在考虑将数组存储为JSON,然后使用JavaScriptSerializer反序列化它。
有没有一个“正确”/更好的方式来做到这一点?
(我的JSON想法感觉有点黑客)
解决方法
您可以使用
System.Collections.Specialized.StringCollection
的AppSettings。
var myStringCollection = Properties.Settings.Default.MyCollection; foreach (String value in myCollection) { // do something }
每个值由新行分隔。
这是一个屏幕截图(德国IDE,但它可能是有用的)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。