Store user settings into application folder

前端 未结 2 1639
时光取名叫无心
时光取名叫无心 2021-01-02 06:52

I\'m using setting from my C# application like this:

String str = Properties.Settings.Default.SETTINGS_NAME;

When I save this settings, a s

2条回答
  •  灰色年华
    2021-01-02 07:37

    If you want it to be Single user or in other way make the configuration of your application portable i will use a custom config file like an .ini file and keep it my app's root folder.

    That way any one want to have those settings can just copy it in his own app's root folder on some other computer. When app runs it just loads the settings and behave accordingly.

    save data in a fixed format like

    [setting_name] = [Setting_value]\n
    

    or in XML file, with Tag name for setting and value for... well... value :)

    You can also go with registry setttings but user don't feel it trivial to copy and merge .reg files

    This is the way i have seen some PC Games (for eg. i frequently changed Crysis and MassEffect settings) and Softwares save their config files.

提交回复
热议问题