views:

206

answers:

2

I was thinking either:

  1. 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?

+2  A: 

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.

Andrew Hare
+1  A: 

The answer to your question depends on the persistence model for the settings:

  • are settings per-user based or machine-wide?
  • are settings app-specific or can/do they need to be used/discovered by other apps as well?
  • are settings default values known at design time or are they generated at install time?
  • are settings local to particular machine or can/will they be roamed?

The standard .Net settings support local per-user settings (when the user runs as a regular user) and local machine-wide settings (when the user runs as admin), both with build-time machine-wide default values and for app-use only. This addresses the majority of scenarios. There is some advanced functionality there which allows to use the .Net Configuration classes with config files in different locations, which can allow for roamable and third-party discoverable settings as well; however, there is no VS tooling support for such scenarios.

Franci Penov