Click here to Skip to main content
15,885,980 members
Please Sign up or sign in to vote.
5.00/5 (3 votes)
See more:
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
Posted
Comments
RaviRanjanKr 28-Feb-11 22:45pm    
Nice Question

Always avoid using the registry if at all possible.
 
Share this answer
 
Comments
fjdiewornncalwe 28-Feb-11 9:27am    
Agreed. +5. The registry should be considered legacy technology when writing new software packages. The latest approach is to use the .config files for this purpose. That being said, there are situations where using the registry would still be considered valid, but the only cases of that which I could justify would be if I was working with older technologies that have been designed to work with the registry. (i.e. MFC)
#realJSOP 28-Feb-11 9:36am    
Even when I was doing MFC programming, I avoided using the registry (to store things) like the plague. Retrieving info from it wasn't a problem though, andwas sometimes necessary.
Sergey Alexandrovich Kryukov 28-Feb-11 11:59am    
And even avoid if it is impossible... my 5.
--SA
Sergey Alexandrovich Kryukov 28-Feb-11 22:28pm    
Please see my generalized answer.
--SA
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.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 28-Feb-11 22:28pm    
Even for multiple applications Registry is not recommended by Microsoft anymore.
(With GAC, the application still does not modify Registry.)
Please see my Answer.
--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
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900