Created
December 20, 2016 11:05
-
-
Save JoanM/15a956b968fca89fc0037240ed97b361 to your computer and use it in GitHub Desktop.
DoCurlAsync with only one ConfigureAwait
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<string> DoCurlAsync() | |
{ | |
using (var httpClient = new HttpClient()) | |
using (var httpResonse = await httpClient.GetAsync("https://www.bynder.com").ConfigureAwait(false)) | |
{ | |
return await httpResonse.Content.ReadAsStringAsync(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actually @JoanM you are incorrect.
Using ConfigureAwait(false) is an anti pattern.
If your application is x async methods deep, you would need to add ConfigureAwait(false) to each and every awaitable down the call stack; otherwise you risk using a method incorrectly sooner or later.