Save application settings ... registry / file?

Where is the best place to store application settings?

In particular, I would like to save settings for the media player, such as volume levels, etc. Two spring candidates in mind ... file and registry. What would be more appropriate?

As a continuation of this, I also wonder if there are any APIs that help in building specific applications.

If someone does not tell me that this is wrong, I would like to save the material either HKCU... or HKLM/Software/MyCompanyName/MyAppName/Keyto the registry or to %APPDATA\MyCompanyName\MyAppName\someTypeOfSettingsFile.

Since they seem to be commonly used for such settings, I would suggest that .Net makes it easy to save settings in these places. Is there a simple high-level API that .Net can offer me to read and write settings to these shared locations?

+1
source share
2 answers

Open settings.settingsVisual Studio in your solution; add the application setting (i.e. change the scope from "user" to "application").

The IDE creates a support class that you can use in your code.

The registry should be avoided.

app.exe.config user.config . Windows Forms , app.exe.config , user.config , Application.LocalUserAppDataPath . ClickOnce, ClickOnce % InstallRoot%\Documents and \_\ .

+5

. Windows Forms. , Windows Forms, .

.

+1

Source: https://habr.com/ru/post/1781876/


All Articles