Multiple async calls in the same statement in C#

Viewed 68

Are all calls happening even if the first returns false? Is the second one waiting for the first one?

if (await callAsync() && await callAsync()) {...}

if (await callAsync() & await callAsync()) {...}

if (await callAsync() || await callAsync()) {...}

1 Answers

In both cases, the calls still happen sequentially in the execution flow, not in parallel. In the first case the second call only happens if the first returns true; in the second case, both will happen either way (assuming no exceptions are thrown).

Related