I recently needed to generate an arbitrary number of unique random numbers, and after a little thinking I found I could get a really elegant solution by using
yield return
yield return
to generate an infinite stream of ints. This made me realise I basically never use this language feature and there's probably a lot of cool applications for it I'm missing. Any tricks/interesting patterns you've written with it?