3 ms·
The sample is not clear?! How would you write the same asynchronous code in C# without the LINQ syntax? Can you give an example? All the code does is get a from
by random314 11y ago
The sample is not clear?!
How would you write the same asynchronous code in C# without the LINQ syntax? Can you give an example?
All the code does is get a from async taska, b from async task b, feed the result of b into task c to get c, and if c contains blah return c+a asynchronously.
- ufmace 11y agoIf you understand it, then exactly what are the return types of these tasks and the types of a, b, and c? Are they single objects or IEnumerables? If they are enumerable, then what exactly does c + a do? It is creating a new enuerable of every a added to every c, like a SQL cross join? If it is a single object, then what exactly does the where clause do? What does it return if c does not contain blah, and what becomes of a in that case? Does it get returned, added to null, disappear into the ether, or does it figure out that it doesn't need it, and never actually evaluate taska? What happens if taska modified some other state somewhere? For that matter, if it's figuring that out, that would control the order that the tasks are evaluated in. What is that, exactly? Is taska run at the same time as taskb, or does it wait to see if there is actually a c to add to it's result? Or maybe it gets evaluated before or after taskb, or at the same time. That stuff matters. I'd rather make it clear at a glance what's going on than write something super short and clever that nobody can figure out the details of.
- runT1ME 11y agohttp://mikehadlow.blogspot.co.uk/2011/01/monads-in-c1-introduction.html http://mikehadlow.blogspot.co.uk/2011/01/monads-in-c1-introd...