One user.conf file for all versions of the application

In my project, I use settings files, and I have fields that have a User area. Thus, the file /AppData/Local/MyCompany/MyApp.exe_Url_wkjotpgbovnyqkbwotylz/0.0.2.2(my app version)/user.confcontains these fields.

As I understand it, this folder was created automatically, and its name was based on my application version.

Is there a way to create a user.conf file regardless of the version of the program?

+4
source share
1 answer

You can always use your own!

, XML- JSON [.NET JSON] [3] (json.org ).

.NET JSON:

:

[DataContract]
    class Settings
    {
        [DataMember]
        internal string food;

        [DataMember]
        internal int bar;
    }

/:

Settings s = new Settings();
MemoryStream stream1 = new MemoryStream();
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Settings));

// Write the settings
ser.WriteObject(stream1, s);

// Read settings
Person p2 = (Person)ser.ReadObject(stream1);
0

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


All Articles