Skip to content

Instantly share code, notes, and snippets.

@burgwyn
burgwyn / gist:5602186
Created May 17, 2013 21:41
This snippet iterates through the AppSettings entries and returns an unordered list of bolded keys and values. I like to add this to the 'About' page that comes bundled in the web project templates in Visual Studio.
StringBuilder sb = new StringBuilder();
if (ConfigurationManager.AppSettings.HasKeys())
{
sb = new StringBuilder( "<ul style=\"list-style-type:none;\">" );
foreach (string key in ConfigurationManager.AppSettings.Keys)
{
sb.AppendFormat( "<li><strong>{0}</strong> - {1}</li>", key, ConfigurationManager.AppSettings[key] );
}