Created
August 19, 2020 04:33
-
-
Save IDontKnower/5df0a1a5d957ec37f719674eafeeacf4 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
static void Main() | |
{ | |
var statuses = GetCodeStatuses(); | |
foreach (var status in statuses) | |
{ | |
Console.WriteLine(status); | |
Task.Delay(1000).Wait(); | |
} | |
} | |
static IEnumerable<int> GetCodeStatuses() | |
{ | |
while (true) | |
{ | |
using (var http = new HttpClient()) | |
{ | |
var response = http.GetAsync("http://google.com").Result; | |
yield return (int) response.StatusCode; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment