There will not be any behavioral difference between the two as both tasks are guaranteed to be finished after the Task.WhenAll
.
The compiler seems not to be aware of this and generates a slightly more complicated state machine in the first case (I verified this by looking at the generated IL, see here for a proof).
However, this will hardly make any noticable performance difference.
(Stylistically, the multiple await would be preferrable to me as seeing a .Result
in async code makes all sort of alarm bells ring).
Update: As Stephen Cleary explained in his answer here, await x
and x.Result
will behave differently (different Exception type) if the task failed. But this does not apply here because any failing task would have already made await Task.WhenAll(...)
throw an exception.