Click here to Skip to main content
15,884,693 members

The Insider News

   

The Insider News is for breaking IT and Software development news. Post your news, your alerts and your inside scoops. This is an IT news-only forum - all off-topic, non-news posts will be removed. If you wish to ask a programming question please post it here.

Get The Daily Insider direct to your mailbox every day. Subscribe now!

 
NewsGetting Too Cute with C# Yield Return Pin
Terrence Dorsey21-Jan-13 12:11
sitebuilderTerrence Dorsey21-Jan-13 12:11 
I ran across a method that returned an IEnumerable<t> recently, and I implicitly typed its return value. During the course of a series of method extractions, code movement, and general refactoring, I wound up with some code that passed the various unit tests in place but failed curiously at runtime. After peering at it for a few minutes and going through once in the debugger, I traced it to a problem that you don’t see every day, and one that probably would have had me tearing my hair out if I didn’t have a good working understanding of what the “yield” keyword in C# does. So today, I’ll present the essence of this problem in the hopes that, if you weren’t aware of it, you are now.
Understanding the IInnumerable pitfalls of deferred execution.
GeneralRe: Getting Too Cute with C# Yield Return Pin
PIEBALDconsult21-Jan-13 15:34
mvePIEBALDconsult21-Jan-13 15:34 
GeneralRe: Getting Too Cute with C# Yield Return Pin
Ranjan.D21-Jan-13 15:45
professionalRanjan.D21-Jan-13 15:45 

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.