Is there any conceptual difference between the following two pieces of code:
async Task TestAsync()
{
await Task.Run(() => DoSomeWork());
}
>
What is the difference between
async Task TestAsync() { await Task.Delay(1000); }
and
Task TestAsync() { return Task.Delay(1000); }
?
I am confused by this question. Let me try to clarify by responding to your question with another question. What's the difference between?
Func MakeFunction()
{
Func f = ()=>1;
return ()=>f();
}
and
Func MakeFunction()
{
return ()=>1;
}
?
Whatever the difference between my two things is, the same difference is between your two things.