Carlos Garcia
Carlos Garcia

Reputation: 2970

Multiple async calls in the same statement in C#

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()) {...}

Upvotes: 4

Views: 78

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1064184

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).

Upvotes: 8

Related Questions