Good point, but also it should always be taken with great care in production scenarios that utilize try/catch in similar code as now you are risking of not having the exception unwrapped in the MakeOneMillionDollars due to not awaiting it here explicitly. But the perf tip is on point as this code will produce one compiler generated type less with its following state machine.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If you starting a new
Task.Runor having a Task in a method without something to do after it, you don't need toasync/awaitit in the method.Example, instead of:
you can just write this:
This removes some
async/awaitoverhead :)Also as already mentioned
Task.Delayinstead ofThread.SleepGood point, but also it should always be taken with great care in production scenarios that utilize try/catch in similar code as now you are risking of not having the exception unwrapped in the
MakeOneMillionDollarsdue to not awaiting it here explicitly. But the perf tip is on point as this code will produce one compiler generated type less with its following state machine.