Skip to content

Instantly share code, notes, and snippets.

@IDontKnower
Created August 19, 2020 04:33
Show Gist options
  • Save IDontKnower/5df0a1a5d957ec37f719674eafeeacf4 to your computer and use it in GitHub Desktop.
Save IDontKnower/5df0a1a5d957ec37f719674eafeeacf4 to your computer and use it in GitHub Desktop.
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