While perusing Twitter I spotted a tweet by a Game Developer I follow that just said;
@ChevyRay 2:44 AM - 5 Jul 2016
i give you: the stupidest 8 lines of code i’ve ever written that is actually used by my game’s codestatic IEnumerable<int> RightAndleft { get { yield return 1; yield return -1; } }
Immediately I looked at it and thought to myself what does this do? I'm sure the post was meant as an in-joke but I just didn't get it. So with that I went and researched yield but that didn't really answer my question.
I wondered if anyone here could shed some light on firstly what it's doing and also why.
yieldallows you to do? I guess I just don't get the syntax?RightAndLeftreturns an instance of this class. tryroslyn.azurewebsites.net/…