Skip to content

Instantly share code, notes, and snippets.

@tugberkugurlu
Created February 25, 2014 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tugberkugurlu/9213503 to your computer and use it in GitHub Desktop.
Save tugberkugurlu/9213503 to your computer and use it in GitHub Desktop.
HttpClient usage sample
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 100; i++)
{
Run();
}
using (HttpClient client = new HttpClient())
{
for (int i = 0; i < 100; i++)
{
Run(client);
}
}
}
static void Run()
{
HttpClient client = new HttpClient();
var response = client.GetAsync("http://tugberkugurlu.com").Result;
}
static void Run(HttpClient client)
{
var response = client.GetAsync("http://tugberkugurlu.com").Result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment