Can someone please explain what is the difference between using await
and the Result
in the async pattern, and where would I use each?
public static async Task<string> GetVersion(int port, string method)
{
var client = new HttpClient();
client.BaseAddress = new Uri("http://localhost:" + port);
return client.GetStringAsync("/test").Result; //<===============this versus
return await client.GetStringAsync("/test").ConfigureAwait(false);//<=====this
}