I am using a library that has both a synchronous and async version of the Reconcile method.
The methods accept 2 IEnumerables and 3 delegates who receive calls for items that are added, changed, or removed from the second list based on the values from the first.
My code currently works with the synchronous version and I would like to convert it to the async version.
Since I really don't need to do any deletion work to delete, I pass (item) => {} for the deletedAction argument.
I found several different versions of how to convert this to an async “empty” delegate scattered all over the Internet and through StackOverflow, but I'm not sure about the difference between them or how it is correct.
What is the difference between these methods of sending an "empty" async delegate as an argument, and which one is the current "most correct" way? Is there a better way that I skipped?
async (item) => {await Task.CompletedTask;}async (item) => {await Task.FromResult(0);}async (item) => {await Task.Yield;}async (item) => {await Task.Delay(0);} (this seems like a bad choice, but I turn it on for completeness)
All of them work, except for Task.CompletedTask , but this is because I use the framework version 4.5.NET Framework and do not exist in this version.
source share