调用ConfigreA的最佳实践-等待所有服务器端代码
ApiController
Task<SomeObject>
ConfigureAwait(false)
?
ConfigureAwait(false)
ApiController
public class CustomerController : ApiController{ public async Task<Customer> Get(int id) { // you are on a particular thread here var customer = await SomeAsyncFunctionThatGetsCustomer(id).ConfigureAwait(false); // now you are on a different thread! will that cause problems? return customer; }
白衣非少年