[英]C# - data structure used for settings file
Does C#
offer something default to store application / any sort of settings? C#
是否提供一些默认值来存储应用程序/任何类型的设置?
I could use Dictionary<K, T>
, but actually I would prefer some structure, which natively supports xml
export / import and different other features, which aren't implemented in the Dictionary
or other map-like collections. 我可以使用Dictionary<K, T>
,但实际上我更喜欢某些结构,该结构本机支持xml
导出/导入以及其他不同的功能,而这些功能在Dictionary
或其他类似地图的集合中均未实现。
For example, in C++
I would use QSettings
in Qt
or something like boost::property_tree
if using boost
. 例如,在C++
,我会用QSettings
在Qt
或类似boost::property_tree
如果使用boost
。
If you have any ideas or good implementations, that would be great. 如果您有任何想法或好的实现,那就太好了。 Thank you. 谢谢。
AppSettings sounds like it fits the bill: AppSettings听起来很合适:
http://odetocode.com/code/345.aspx http://odetocode.com/code/345.aspx
Yes, I think this is what you are looking for: http://msdn.microsoft.com/en-us/library/k4s6c3a0.aspx 是的,我认为这是您要查找的内容: http : //msdn.microsoft.com/zh-cn/library/k4s6c3a0.aspx
Example of how it's used herE: http://msdn.microsoft.com/en-us/library/aa730869%28v=vs.80%29.aspx 有关如何使用herE的示例: http : //msdn.microsoft.com/zh-cn/library/aa730869%28v=vs.80%29.aspx
If Properties.Settings doesn't work for you, then you might just create your own class hierarchy of settings, and use simple XML serialization/deserialization to handle the file I/O. 如果Properties.Settings不适用于您,那么您可能只是创建自己的类的层次结构,并使用简单的XML序列化/反序列化来处理文件I / O。 I find this much more flexible than .NET settings. 我发现它比.NET设置灵活得多。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.