❔ Trying to generify List Func Task
Im trying to generify the following code.
I think my intention is clear, I have several ways to query contracts that are prioritized a certain way. If i dont find anything in the first priority list, check the 2nd, if i dont find anything, check the 3rd and so on.
I got this so far
I can call it like this
Are there any issues with this? Does this work simpler?
Working with tasks and lists of tasks and async await is always kinda dangerous. But it seems to work.
The
GetContractsPrioX
methods fire only if needed. If I have an exception in one of them, everything seems to behave normally, nothing gets swallowed.
I would like to remove the () => part, but I dont think its possible. If I remove it and just work with the GetContractsPrioX
methods directly, the tasks naturally start executing instantly.3 Replies