Tag Archives: configuration

c# – accessig application configuration file using ConfigurationManager

Using configuration file is pretty straightforward. First  add to your application references Assembly System.Configuration. ConfigurationManager provides access to configuration files for client applications, It makes sense to encapsulate configuration settings read and write to special methods.   public static string ReadSetting(string key, string defaultValue = “Not Found”) { var appSettings = ConfigurationManager.AppSettings; string result = appSettings[key] ?? defaultValue;… Read More »