IDisposable, IAsyncDisposable, and Tasks: Dispose Behavior With Tasks In C#

While working with HTTP calls that return a Stream via HttpClient’s var response = await SendAsync(request, HttpCompletionOption.ResponseHeadersRead); -> var stream = await response.Content.ReadAsStreamAsync(); method for efficient handling of streamed data Brian Dunnington identified the response should be disposed and pointed me to https://www.stevejgordon.co.uk/using-httpcompletionoption-responseheadersread-to-improve-httpclient-performance-dotnet. [Read More]
Tags: dotnet