Created
January 6, 2012 19:05
-
-
Save KevM/1571947 to your computer and use it in GitHub Desktop.
Pretty printing a silly collection? Seems like there should be a simpler way.
This file contains hidden or 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
| public static class NameValueCollectionExtensions | |
| { | |
| public static string PrettyPrint(this NameValueCollection collection) | |
| { | |
| var keys = collection.AllKeys.Select(k => "{0} : {1}".ToFormat(k, collection[k])); | |
| return String.Join(Environment.NewLine, keys); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi KevM,
I can't seem to track down the "ToFormat" method for the string object. Can you describe the namespace which encapsulates this method?
Thanks!