Click here to Skip to main content
15,886,919 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Is there a tool out there for unraveling iterators and yield from C# code? Pin
honey the codewitch17-Nov-23 4:18
mvahoney the codewitch17-Nov-23 4:18 
GeneralRe: Is there a tool out there for unraveling iterators and yield from C# code? Pin
Jörgen Andersson17-Nov-23 5:03
professionalJörgen Andersson17-Nov-23 5:03 
AnswerRe: Is there a tool out there for unraveling iterators and yield from C# code? Pin
jschell17-Nov-23 5:59
jschell17-Nov-23 5:59 
GeneralRe: Is there a tool out there for unraveling iterators and yield from C# code? Pin
honey the codewitch17-Nov-23 6:11
mvahoney the codewitch17-Nov-23 6:11 
GeneralRe: Is there a tool out there for unraveling iterators and yield from C# code? Pin
jschell20-Nov-23 7:03
jschell20-Nov-23 7:03 
GeneralRe: Is there a tool out there for unraveling iterators and yield from C# code? Pin
honey the codewitch20-Nov-23 7:04
mvahoney the codewitch20-Nov-23 7:04 
GeneralRe: Is there a tool out there for unraveling iterators and yield from C# code? Pin
jschell20-Nov-23 8:26
jschell20-Nov-23 8:26 
GeneralRe: Is there a tool out there for unraveling iterators and yield from C# code? Pin
honey the codewitch20-Nov-23 8:35
mvahoney the codewitch20-Nov-23 8:35 
Yep, that's iterators.

Note that there is no intrinsic .NET support for this feature. It is a feature of the C# compiler, which works by transforming the code.

The C# compiler transforms it into a state machine based coroutine by

A) hoisting local variables to make them members of the IEnumerator implementation.
B) Implementing MoveNext() such that wherever there's a yield, that's a new state in the state machine. Because the routine actually returns at that point. When you call it again, it is "restarted" where it left off using the state machine.

All iterators are state machines once the compiler is done mangling that code.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix

GeneralAI coding goes visual Pin
Gary Stachelski 202116-Nov-23 13:37
Gary Stachelski 202116-Nov-23 13:37 
GeneralDid I miss the Daily Build today? Pin
honey the codewitch16-Nov-23 13:16
mvahoney the codewitch16-Nov-23 13:16 
GeneralRe: Did I miss the Daily Build today? Pin
MarkTJohnson16-Nov-23 13:28
professionalMarkTJohnson16-Nov-23 13:28 
GeneralRe: Did I miss the Daily Build today? Pin
honey the codewitch16-Nov-23 13:33
mvahoney the codewitch16-Nov-23 13:33 
JokeRe: Did I miss the Daily Build today? Pin
Daniel Pfeffer16-Nov-23 15:47
professionalDaniel Pfeffer16-Nov-23 15:47 
GeneralWordle 881 Pin
StarNamer@work16-Nov-23 13:02
professionalStarNamer@work16-Nov-23 13:02 
GeneralRe: Wordle 881 Pin
Amarnath S16-Nov-23 13:18
professionalAmarnath S16-Nov-23 13:18 
GeneralRe: Wordle 881 Pin
Sandeep Mewara16-Nov-23 14:52
mveSandeep Mewara16-Nov-23 14:52 
GeneralRe: Wordle 881 Pin
GKP199216-Nov-23 17:19
professionalGKP199216-Nov-23 17:19 
GeneralRe: Wordle 881 Pin
Shane010316-Nov-23 17:32
Shane010316-Nov-23 17:32 
GeneralRe: Wordle 881 Pin
Sander Rossel16-Nov-23 20:40
professionalSander Rossel16-Nov-23 20:40 
GeneralRe: Wordle 881 - 5 4 me Pin
pkfox16-Nov-23 21:00
professionalpkfox16-Nov-23 21:00 
GeneralRe: Wordle 881 Pin
Cp-Coder17-Nov-23 0:37
Cp-Coder17-Nov-23 0:37 
GeneralRe: Wordle 881 Pin
ChandraRam17-Nov-23 0:49
ChandraRam17-Nov-23 0:49 
GeneralIt was only a matter of time.... Pin
Gary Stachelski 202116-Nov-23 13:02
Gary Stachelski 202116-Nov-23 13:02 
GeneralRe: It was only a matter of time.... Pin
PIEBALDconsult16-Nov-23 13:40
mvePIEBALDconsult16-Nov-23 13:40 
GeneralRe: It was only a matter of time.... Pin
Sander Rossel16-Nov-23 20:51
professionalSander Rossel16-Nov-23 20:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.