I am looking to implement co-routines (user schedualed threads) in c#. When using c++ I was previously using fibers. As I see on the internet fibers do not exist in C#. I would like to get simillar functionality.
Is there any "right" way to implement coroutines in c#?
I have thought of implementing this using threads that aqcuire a single exection mutex + 1 one schedualer thread which releases this mutex for each coroutine. But this seems very costly (it forces a context switch between each coroutine)
I have also seen the yeild iterator functionality, but as I understand you can't yeild within an internal function (only in the original ienumerator function). So this does me little good.