Created
August 1, 2012 13:04
-
-
Save ElemarJR/3226689 to your computer and use it in GitHub Desktop.
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
public async Task<IEnumerable<string>> GetLinksFromMsdnAsync() | |
{ | |
var response = await new WebClient(). | |
DownloadStringTaskAsync("http://msdn.microsoft.com/pt-br/"); | |
var regex = "href\\s*=\\s*(?:\"(?<1>[^\"]*)\"|(?<1>\\S+))"; | |
return Regex.Matches(response, regex) | |
.OfType<Match>() | |
.Select(m => m.Groups[1].Value); | |
} | |
public async void PrintLinksFromMSDNAsync() | |
{ | |
var links = await GetLinksFromMsdnAsync(); | |
foreach (var link in links) | |
Console.WriteLine(link); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment