How to use RestSharp with async/await
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm struggling to find a modern example of some asynchronous C# code that uses RestSharp with async and await . I know there's been a recent update by Haack but I don't know how to use the new methods. Also, how can I provide a cancellation token so that the operation can be canceled (say, if a person is sick of waiting and presses the Cancel button in the app's UI). 回答1: Well, the update Haack is referring to has been made by me :) So let me show you how to use it, as it is actually very simple. Previously you had methods like