Created
May 17, 2013 21:41
-
-
Save burgwyn/5602186 to your computer and use it in GitHub Desktop.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] ); | |
} | |
sb.Append( "</ul>" ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment