Ben
Ben

Reputation: 62484

Saving a user's configuration

I'm working with a small command line application in C#. Is the ConfigurationManager a good solution for this? Is this a configuration I can write to, or is it read only?

This page: http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.appsettings.aspx provides a clear indication that I can read data.

My objective is to collect some information via command line prompts and write what's entered into a file the application can use with other commands.

Thanks for the help, I'm new to C# so I'm just figuring this stuff out.

Upvotes: 0

Views: 82

Answers (1)

Oded
Oded

Reputation: 499362

I suggest using the Settings functionality instead of ConfigurationManager - if you wish to read/write user settings, that's the right tool.

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.

Upvotes: 2

Related Questions