How programs track global settings (which are the same every time the program starts)

So, for example, when I download a word, if I go to save the file, by default the same directory that I selected the last time will be selected ... It also tracks the last 10 (or something else) .doc files that you opened

how to do it? Right now, for the program I am writing (in C #), I am just saving a text document that contains such settings ... is this a bad practice?

If not, where should I put this text document. Now I just use:

 Path.GetDirectoryName(Application.ExecutablePath);

like the directory in which this file is stored ... its fine before I publish the program, because it just uses one of the folders in the solutions directory ...

But after publication, the directory is really strange:

C: \ Users \ me \ AppData \ Local \ Apps \ 2.0 \ J6AAL16C.2QW .....

and it goes on .... So is it like a directory created for this program when I install it? this is where it SHOULD be saved?

Thank!!

+3
source share
1 answer

The Application Settings feature in .NET makes this pretty simple, in fact. In particular, I would not use the registry if I were you, it makes it difficult for users to copy settings from machine to machine, etc.

This is a bit strange if you are trying to write your own customization providers, although I tried to understand the overall design a couple of times and always got lost. However, for simple applications this is easy.

+3
source

All Articles