Async programming has become ubiquitous and the standard tool for making async HTTP requests with C# is HttpClient
from the System.Net.Http
namespace. Examples are aplenty, but good examples are few and far between. Because HttpClient
implements IDisposable
we are conditioned to new it up in a using statement, make the call and get out as fast as possible.
This is WRONG.
This blog post will pull together advice from the few good resources online that touch on various aspects of why you are using it wrong, and how to use it correctly.