3

Currently, I have a form that has various radio buttons, directory browsers, date pickers etc. The application uses the settings, and executes a file deletion task. I was wondering what is the best strategy to save these settings to an external file that can be loaded at a later date. So essentially each configuration can be loaded, executed, and then another configuration loaded. Also, the configuration can be passed across installations / users.

I dont believe I can use the internal .settings file because I will have multiple sets of settings that can be loaded.

4

1 回答 1

1

有多种格式可供选择用于存储设置,例如:

  • INI
  • CSV
  • YAML
  • JSON
  • XML

最好的策略之一是使用 XML。XML 是最流行的设置/配置文件格式之一,因为它易于解析、语法规范、功能强大且易于阅读。

使用 XML 文件允许在安装之间传递配置并在用户之间共享。

此外,如果您有一个描述您的 XML 配置文件的 XSD(模式文件),那么您的应用程序验证不同的配置文件是很简单的。

于 2013-01-09T01:58:23.117 回答