ConvertStringToAppSetting for CodeRush provides a Refactoring to aid in the createion of simple settings.
Once installed, this refactoring is available via the CodeRush Refactor menu.
- Starting with a simple String literal
- Place your caret within the literal and hit your CodeRush\Refactor key. (Defaults to Ctrl+`)
- Choose Convert String to AppSetting from the menu.
- Your string literal will be replaced with a call to ConfigurationManager.AppSettings
- If you didn't already have one, an app.config file will have been created and added to your project.
- Your app.config file will have a new entry in it to account for your new setting.
- Note: The AppSettings 'key' attribute and the ConfigurationManager.AppSettings values have been linked together so that you can alter them as one.
- Once you are happy with your new settings key, hit enter and your changes are confirmed.
This plugin requires CodeRush. You can locate a free trial of CodeRush here.
CodeRush is a powerful productivity tool built byDevExpress. It is designed to help you produce higher quality, more readable code with far less effort and in a fraction of the time.