Last active
November 18, 2015 13:57
-
-
Save akselqviller/537b3a29a6746cd94afd to your computer and use it in GitHub Desktop.
C# keywords poet-omatic
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
| var pageContent = new System.Net.WebClient().DownloadString("https://msdn.microsoft.com/en-us/library/x53a06bb.aspx"); | |
| var keywords = new Regex(@".aspx"">(\w+)</a>").Matches(pageContent).Cast<Match>() | |
| .Select(m => m.Groups[1].Value).OrderBy(s => s).ToList(); | |
| var rand = new Random(); | |
| var poem = string.Join("\n", | |
| Enumerable.Range(0, 3).Select(l => String.Join(" ", | |
| Enumerable.Range(0, rand.Next(1, 5)) | |
| .Select(w => keywords[rand.Next(keywords.Count)])))); | |
| poem.Dump(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run with LINQPad