Use the Result
property on the asynchronous Task, like so:
// Synchronous method
void Method()
{
var task = MethodAsync();
var result = task.Result;
}
// Asynchronous method
public async Task<int> MethodAsync()
{
return await Task.Run(() => { return 1; });
}