Click here to Skip to main content
13,448,385 members (56,013 online)

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
staffTerrence 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
memberPIEBALDconsult21-Jan-13 15:34 
GeneralRe: Getting Too Cute with C# Yield Return Pin
Ranjan.D21-Jan-13 15:45
memberRanjan.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.

Advertise | Privacy |
Web01-2016 | 2.8.180318.3 | Last Updated 19 Mar 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid