title: HttpClientFactory.Create vs new HttpClient
body: <p>I am curious what is the purpose of the <a href="http://msdn.microsoft.com/en-us/library/system.net.http.httpclientfactory(v=vs.108).aspx" rel="nofollow noreferrer"><code>HttpClientFactory</code> class</a>. There is no description of why it exists on MSDN (see link).</p>
  <p>There are <a href="http://msdn.microsoft.com/en-us/library/system.net.http.httpclientfactory.create(v=vs.108).aspx" rel="nofollow noreferrer"><code>Create</code> methods</a> with more specialized arguments, but mostly I wonder what is the difference between the call with no parameters and the normal constructor.</p>
  <hr />
  <pre class="lang-cs prettyprint-override"><code>var httpClient = HttpClientFactory.Create();
  </code></pre>
  <p>VS</p>
  <pre class="lang-cs prettyprint-override"><code>var httpClient = new HttpClient();
  </code></pre>
  <hr />
  <p>In most examples I see the use of <code>new HttpClient()</code>, without any <code>using</code> statements, even though the <a href="http://msdn.microsoft.com/en-us/library/system.net.http.httpclient(v=vs.110).aspx" rel="nofollow noreferrer"><code>HttpClient</code> class</a> derives from <code>IDisposable</code>.</p>
  <p>Since the <code>HttpClient</code> class derives from <code>IDisposable</code>, is there some pooling or caching done by the factory? Are there performance benefits, or does it not matter?</p>
  <h2>Update – <code>IHttpClientFactory</code> in .NET Core 2.1</h2>
  <p>Please note that since this question was asked, newer versions of .NET have been released, and .NET Core 2.1 introduced a new and much improved approach for getting a HTTP client.</p>
  <p>Refer to Ali Bayat's answer below for using <code>IHttpClientFactory</code> instead with .NET Core.</p>
  <p>However, I'm keeping Darrel Miller's answer as the accepted answer since this is the correct answer for usage in .NET Framework up to v4.8, for which this question was asked.</p>
  <p>With .NET 5 the discrepancy between .NET Framework and .NET Core will be aligned, and you should use <code>IHttpClientFactory</code> instead.</p>
  <h2>Update – Official guidance</h2>
  <p>Microsoft has added documentation regarding the disposal behavior and recommended use:
  <a href="https://docs.microsoft.com/en-us/dotnet/fundamentals/networking/httpclient-guidelines" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/fundamentals/networking/httpclient-guidelines</a></p>