|
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 ]
|