async/await function comparison
问题 I am trying to understand async/await and I am wondering if both methods work identically.If not can you explain why? public async Task<Client> GetClient() { return await _clientRepository.GetAll().Where(x => x.Id == 1).FirstOrDefaultAsync(); } public Task<Client> GetClient2() { return Task.FromResult(_clientRepository.GetAll().Where(x => x.Id == 1).FirstOrDefault()); } public async Task Run() { var result = await GetClient(); var result2 = await GetClient2(); } 回答1: Let me point out a few