Compiler generates a different IAsyncStateMachine for await foreach to handle iteration on async enumerables. It contains a MoveNextAsync method beside MoveNext. So we can find this pattern by checking if this method exists and based on that transform the statements to await foreach.
Compiler generates a different IAsyncStateMachine for
await foreachto handle iteration on async enumerables. It contains aMoveNextAsyncmethod besideMoveNext. So we can find this pattern by checking if this method exists and based on that transform the statements toawait foreach.