CSharpFeeds - All your C# feeds in one place.

Sunday, March 02, 2008

C# 4 idea: Iterator blocks and parameter checking

by skeet via Jon Skeet's Coding Blog : C# on 3/2/2008 7:54:44 PM

Iterator blocks have an interesting property: they defer execution. When the method (or property) is called, none of your code is executed - it only starts running when MoveNext() is first called. Deferred execution is a great thing in many ways, but it's a pain when it comes to parameter checking. If you check parameters within an iterator block, you've effectively left a timebomb - the error will be potentially reported a long way from the original source of the problem. (Side-note: th ...

[ read more ]

Trivia: when is a no-op not a no-op?

by skeet via Jon Skeet's Coding Blog : C# on 3/2/2008 7:05:27 PM

Hopefully most readers are familiar with the yield break; statement. Usually, if it appears at the end of a method its a no-op which can be removed with no change in behaviour. For instance: public IEnumerable<int> Range1 (int start, int count) {     for (int i=0; i < count; i++)     {          yield return start+i;     ...

[ read more ]

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us