Closed nicolaiw closed 4 years ago
Like here https://github.com/Mr-Markus/ZigbeeNet/blob/develop/libraries/ZigBeeNet/ZigBeeNetworkManager.cs#L992 we should avoid to call "return await" if possible as the compile will generate a state machine. Just return the Task direcly. In most cases it is not necessary to call await when there is nothing to do after awaiting the task. (It might by when combined with using)
I made a quick example. Have a look at the difference IL code.
https://sharplab.io/#v2:CYLg1APgAgTAjAWAFBQAwAIpwKwG5nJQDMmM6AwugN7Lp3q30AOATgJYBuAhgC4CmmAGzoASgFcAdgEEAzgE8JAYwD6cABQBKRnRpJ6+zAHYhAOnES1m9AF4AfNQC+G/HvoPtDV3VadeAqAAcQqKSsgoqMJoeugb0UACcpuaWGjb2VE4u+u5IDkA
fixed in PR #90
Thx for quick implementation
Like here https://github.com/Mr-Markus/ZigbeeNet/blob/develop/libraries/ZigBeeNet/ZigBeeNetworkManager.cs#L992 we should avoid to call "return await" if possible as the compile will generate a state machine. Just return the Task direcly. In most cases it is not necessary to call await when there is nothing to do after awaiting the task. (It might by when combined with using)