Do I have to await an async method?

前端 未结 2 1844
生来不讨喜
生来不讨喜 2021-01-22 04:12

I use a HttpClient that only supports async methods. Do I have to await them in the calling method (not in the async method itself, I have to await the

2条回答
  •  耶瑟儿~
    2021-01-22 05:07

    I don't really need multithreading in that project.

    async is about asynchrony, not multithreading.

    I would be fine blocking and waiting until I get a response from HttpClient as I need to have the data anyway. This is a Console application.

    In this case, then, I'd just say to keep everything synchronous. That is, use WebClient instead of HttpClient.

提交回复
热议问题