Search code examples
c#appsettingsapplication-settings

In a given C# Windows Forms application/WPF, where are user settings usually stored?


I was thinking either:

  1. An Appconfig file

  2. A generic .XML file and have the program load values at launch.

What is the best way to do this? A website with a best user tutorial perhaps?


Solution

  • Please see Using Settings in C#:

    The .NET Framework 2.0 allows you to create and access values that are persisted between application execution sessions. These values are called settings. Settings can represent user preferences, or valuable information the application needs to use. For example, you might create a series of settings that store user preferences for the color scheme of an application. Or you might store the connection string that specifies a database that your application uses. Settings allow you to both persist information that is critical to the application outside of the code, and to create profiles that store the preferences of individual users.