哪个更好:使用registery来存储设置或使用Settings类 [英] which is better : use of registery in order to store setting or use of Settings class

查看:63
本文介绍了哪个更好:使用registery来存储设置或使用Settings类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
哪个更好:使用registery来存储设置或使用Settings类,在哪里有用使用registery?
Thank

hello
which is better : use of registery in order to store setting or use of Settings class and where is useful use of registery ?
thank

推荐答案

尽可能避免使用注册表.
Always avoid using the registry if at all possible.


如果这些设置属于一个,设置文件会更好应用程序.

当设置对多个应用程序通用时,注册表是更好的选择.

例如,GAC利用注册表使程序集全局可用.
Settings file would be better if those settings belong to one application.

Registry is better option when a setting is common to multiple application.

Example, GAC makes use of registry to make an assembly available globally.


我想添加更通用的答案.

Microsoft不再在应用程序中使用注册表.建议的做法是使用一些特殊的目录来存储数据文件.一个人应该使用System.Environment.GetFolderPath方法找出用于不同目的的目录.通常,您应该使用
返回的目录 System.Environment.GetFolderPath(System.SpecialFolder.LocalApplicationData)用于每个用户帐户存储与应用程序相关的数据文件.

有关其他特殊文件夹及其用途,请参见枚举类型System.SpecialFolder.

—SA
I want to add more general Answer.

Microsoft is going away from using Registry in applications. The recommended practice is using some special directories for storing of data files. One should use System.Environment.GetFolderPath method to find out the directory used for different purposes. Typically, you should use directory returned by
System.Environment.GetFolderPath(System.SpecialFolder.LocalApplicationData) for storing application-related data files per user account.

See enumeration type System.SpecialFolder for other special folders and their uses.

—SA


这篇关于哪个更好:使用registery来存储设置或使用Settings类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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