This is related to Writing a multithreaded mapping iterator in Java but I now want to do the same thing in C#.
I have an IEnumerator<F>
defining a sequence of input items, and a Function<F, T>
that I want to apply to each item; I want to deliver the results of these functions as an IEnumerator<T>
. And I want it to be multithreaded, so that the functions are applied in different threads (we can assume the function is expensive to compute). I'm flexible about things like scheduling policies.
How would you suggest implementing this in C#?