Suppose I had an async method like
public async Task<bool> GetBoolAsync()
{
// Do some stuff
return await GetMyBoolFromSomeFunction(somestuff);
}
and I wanted a synchronous version, this compiles just fine, but is it the correct way?
public bool GetBool()
{
return GetBoolAsync().Result;
}
or if there were no return value,
public async Task DoSomethingAsync()
{
// Do some stuff
await DoSomethingFromSomeFunction(somestuff);
}
public void DoSomething()
{
DoSomethingAsync().Wait();
}