<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx</link><description>This Stack Overflow question has reminded me of something I often wish existed in common exception constructors - an overload taking a format string and values. For instance, it would be really nice to be able to write: throw new IOException( &amp;quot;Expected</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1669869</link><pubDate>Sat, 07 Feb 2009 20:44:56 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1669869</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;@Peter: I&amp;#39;m pretty sure (though I haven&amp;#39;t checked) that the rules for picking the &amp;quot;best&amp;quot; method would do the right thing there.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1669869" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1669868</link><pubDate>Sat, 07 Feb 2009 20:42:20 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1669868</guid><dc:creator>Peter Morris</dc:creator><description>&lt;p&gt;I presume the constructor would look like this&lt;/p&gt;
&lt;p&gt;Exception(string message, params object[] values)&lt;/p&gt;
&lt;p&gt;If so, how would this work?&lt;/p&gt;
&lt;p&gt;try&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp;throw InvalidOperationException();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;catch(Exception e)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp;throw new MyException(e.Message, e);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Is &amp;quot;e&amp;quot; a format value, or an inner exception?&lt;/p&gt;
&lt;p&gt;:-)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1669868" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1667383</link><pubDate>Fri, 30 Jan 2009 16:30:41 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1667383</guid><dc:creator>David Nelson</dc:creator><description>&lt;p&gt;Language support would be nice, although C# is already getting too close to C++ - like complexity for my taste.&lt;/p&gt;
&lt;p&gt;@Cedric&lt;/p&gt;
&lt;p&gt;Phil Haack just wrote a couple of posts on &amp;quot;Named Format Strings&amp;quot; which explores that topic in C# (&lt;a rel="nofollow" target="_new" href="http://haacked.com/archive/2009/01/04/fun-with-named-formats-string-parsing-and-edge-cases.aspx"&gt;haacked.com/.../fun-with-named-formats-string-parsing-and-edge-cases.aspx&lt;/a&gt;)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1667383" width="1" height="1"&gt;</description></item><item><title>re: string interpolation</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1667201</link><pubDate>Fri, 30 Jan 2009 05:26:39 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1667201</guid><dc:creator>Cedric</dc:creator><description>&lt;p&gt;In some .NET programming languages, at least in Boo ( &lt;a rel="nofollow" target="_new" href="http://boo.codehaus.org/"&gt;http://boo.codehaus.org/&lt;/a&gt; ), there is string interpolation expressions, which allows for any string:&lt;/p&gt;
&lt;p&gt;&amp;quot;Expected to read ${requiredSize} bytes but only ${bytesRead} were available&amp;quot;&lt;/p&gt;
&lt;p&gt;Easy to use (moreso than Python&amp;#39;s %) and easy to read.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1667201" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1666494</link><pubDate>Wed, 28 Jan 2009 06:29:11 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1666494</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;@David: I agree there&amp;#39;s a line to be drawn, and that it would be a pain to have the overloads everywhere. I just find myself wanting it so often that it annoys me.&lt;/p&gt;
&lt;p&gt;Perhaps, as Steve Cooper says, the answer isn&amp;#39;t to change all the methods, but to give language support for string.Format. Hmm.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1666494" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1666472</link><pubDate>Wed, 28 Jan 2009 00:36:05 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1666472</guid><dc:creator>David Nelson</dc:creator><description>&lt;p&gt;Convenience is one thing, but where do you draw the line? Like I said, I don&amp;#39;t want to see every single method in the framework which takes a string overloaded to also take a format string. If that&amp;#39;s not what you&amp;#39;re advocating, then I guess I don&amp;#39;t see why you think that this particular overload is any more useful than any other method anywhere in the framework that takes a string. Especially since it would have to duplicated in every single Exception class to have any real value.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1666472" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1666257</link><pubDate>Tue, 27 Jan 2009 06:39:42 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1666257</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;@David: Simply for the sake of convenience. We do plenty of things for the sake of convenience - adding a couple of overloads to places where they&amp;#39;re going to be really, really useful seems appropriate to me.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1666257" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1666154</link><pubDate>Tue, 27 Jan 2009 00:30:48 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1666154</guid><dc:creator>Da vid Nelson</dc:creator><description>&lt;p&gt;@Jon,&lt;/p&gt;
&lt;p&gt;No, I don&amp;#39;t explicitly call Format when using Console.WriteLine, but only because the overload is already there, so I might as well use it. That is not the same thing as saying that I think it was worth creating that overload in the first place. Why create the extra maintenance overhead to every method which takes a string, when String.Format is already documented and well known?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1666154" width="1" height="1"&gt;</description></item><item><title>Quick rant: why isn't there an Exception(string, params object[]) constructor? - Jon Skeet: Coding Blog</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665958</link><pubDate>Mon, 26 Jan 2009 06:34:23 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665958</guid><dc:creator>DotNetShoutout</dc:creator><description>&lt;p&gt;Thank you for submitting this cool story - Trackback from DotNetShoutout&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665958" width="1" height="1"&gt;</description></item><item><title>python-style string formattin for c#</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665604</link><pubDate>Sat, 24 Jan 2009 19:32:01 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665604</guid><dc:creator>Steve Cooper</dc:creator><description>&lt;p&gt;You got me thinking about ways to make String.Format work more easily; if String.Format wasn&amp;#39;t so intrusive in the code, (say, if it were like python&amp;#39;s format,) then it wouldn&amp;#39;t be an issue. &lt;/p&gt;
&lt;p&gt;An example solution (and a fantastic abuse of programming in unicode) can be found here;&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.stevecooper.org/2009/01/24/python-style-string-formatting-for-c/"&gt;www.stevecooper.org/.../python-style-string-formatting-for-c&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665604" width="1" height="1"&gt;</description></item><item><title>Steve Cooper  &amp;raquo; Blog Archive   &amp;raquo; Python-style string formatting for C#</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665600</link><pubDate>Sat, 24 Jan 2009 19:28:19 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665600</guid><dc:creator>Steve Cooper  » Blog Archive   » Python-style string formatting for C#</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;Steve Cooper &amp;nbsp;&amp;raquo; Blog Archive &amp;nbsp; &amp;raquo; Python-style string formatting for C#&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665600" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665554</link><pubDate>Sat, 24 Jan 2009 16:55:20 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665554</guid><dc:creator>Chris Nahr</dc:creator><description>&lt;p&gt;No problem, and I&amp;#39;m not saying you&amp;#39;re guaranteed vast performance improvements or anything, just that this particular micro-optimization is about as simple and harmless as it gets, so if you start anywhere you might as well start here. :)&lt;/p&gt;
&lt;p&gt;Good point about switch/case statements, the C# compiler unfortunately can&amp;#39;t figure out that a ThrowHelper method won&amp;#39;t return (and I couldn&amp;#39;t find a method attribute to that effect), so you would need an extra break/return statement.&lt;/p&gt;
&lt;p&gt;As for the implementation, I&amp;#39;m not using any generics, just a separate method for every exception type and possible argument combination I want to throw. &amp;nbsp;That&amp;#39;s also how the BCL implements ThrowHelper, by the way. &amp;nbsp;There actually aren&amp;#39;t all that many common types -- Argument/Null/OutOfRange and InvalidOperation cover most possibilities. &amp;nbsp;Throw in some I/O-related and application-specific exceptions, and you&amp;#39;re pretty much done.&lt;/p&gt;
&lt;p&gt;The syntax follows the statement syntax, e.g. ThrowHelper.ThrowArgumentException. &amp;nbsp;I&amp;#39;m adding a ...WithFormat to the name for overloads that specify a format string with formatting arguments because I found that the overloads can get too confusing otherwise. &amp;nbsp;Of course that&amp;#39;s a question of personal taste.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665554" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665525</link><pubDate>Sat, 24 Jan 2009 15:21:57 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665525</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;@Chris: Having given my skeptical view, I will try it for protocol buffers, where efficiency really is important and inlining could make a significant difference. I don&amp;#39;t mean to seem ungrateful in my comments :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665525" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665471</link><pubDate>Sat, 24 Jan 2009 12:47:12 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665471</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;It&amp;#39;s not as easy to read, because it&amp;#39;s something else to learn that&amp;#39;s non-standard. Everyone knows what a throw statement does - and that includes the compiler, which knows that execution won&amp;#39;t go beyond it. (Think about the end of a switch case, for example.)&lt;/p&gt;
&lt;p&gt;How do you throw an arbitrary exception with a message in ThrowHelper? Does it use generics and reflection together for speed and assume the exception will have the appropriate constructor? Or do you have one method for each type of exception you want to throw?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665471" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665424</link><pubDate>Sat, 24 Jan 2009 10:42:57 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665424</guid><dc:creator>Chris Nahr</dc:creator><description>&lt;p&gt;Given that a ThrowHelper call is about as easy to write and read as an explicit throw statement, I don&amp;#39;t really see why you would ever not want to save those 30-60 bytes of machine code per occurrence. &amp;nbsp;It&amp;#39;s not like you&amp;#39;re introducing a complex reformulation of an algorithm -- it&amp;#39;s usually a simple textual replacement, one statement vs one method call.&lt;/p&gt;
&lt;p&gt;Once I had realized how costly throw is, I just replaced throw with ThrowHelper everywhere. &amp;nbsp;There&amp;#39;s no downside, you make your binary image smaller, and the JITter gets new chances at inlining -- what&amp;#39;s not to like?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665424" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665411</link><pubDate>Sat, 24 Jan 2009 10:04:51 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665411</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;With the added benefit of formatting (and anything else useful, such as nullity checking etc) I can see an argument for using a ThrowHelper all over the place. The performance argument doesn&amp;#39;t sway me for anything other than performance-critical code, where micro-optimisation is more reasonable. It&amp;#39;s nice to know, for the sake of those few places where performance really *is* that important, but I&amp;#39;m happy to leave it to those places.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665411" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665406</link><pubDate>Sat, 24 Jan 2009 09:52:32 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665406</guid><dc:creator>Chris Nahr</dc:creator><description>&lt;p&gt;Jon, the fundamental issue is that a throw statement translates into a surprisingly large amount of machine code. &amp;nbsp;Checking the JITter output for both platforms (32/64 bit) and compiler modes (debug/release) on .NET 3.5 SP1, I counted between 30 and 60 extra bytes compared to an equivalent ThrowHelper call.&lt;/p&gt;
&lt;p&gt;For one thing, that&amp;#39;s going to bloat your code image significantly if you carefully guard all your arguments etc., as the entire rest of a short method is often shorter than the output for a single throw.&lt;/p&gt;
&lt;p&gt;For another thing, the extra size is going to prevent inlining of short methods. &amp;nbsp;I quickly found a test case for getter-sized methods where a ThrowHelper variant would get inlined but the throw variant would not.&lt;/p&gt;
&lt;p&gt;The 2nd ed. of the &amp;quot;Framework Design Guidelines&amp;quot; also recommends using exception builder methods for this reason (page 220f), although they incorrectly claim that throw code never gets inlined (it does, it&amp;#39;s just often too big). &amp;nbsp;And if you look through the BCL with Reflector you&amp;#39;ll find that Microsoft used ThrowHelper calls all over the place, in preference of throw statements.&lt;/p&gt;
&lt;p&gt;Also, I hear some people want string formatting with their exceptions, and a ThrowHelper class is a convenient place for that functionality. :)&lt;/p&gt;
&lt;p&gt;Another thought regarding String.Format: you should generally specify an explicit IFormatProvider (usually either CurrentCulture or InvariantCulture). &amp;nbsp;What should the implicit formatting culture be for that hypothetical formatting constructor provided by the exception? &amp;nbsp;Wouldn&amp;#39;t you need yet another ctor that also takes an IFormatProvider? &amp;nbsp;That&amp;#39;s another argument for custom ThrowHelper methods, since you just specify the desired IFormatProvider in one place.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665406" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665395</link><pubDate>Sat, 24 Jan 2009 09:23:59 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665395</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;@Chris: Could you explain your reasoning for the &amp;quot;ThrowHelper&amp;quot; class? It sounds like another level of indirection for no good reason, unless it makes a *huge* performance gain. What kind of thing is in there, and what difference does it make?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665395" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665383</link><pubDate>Sat, 24 Jan 2009 08:54:13 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665383</guid><dc:creator>Serge Wautier</dc:creator><description>&lt;p&gt;My quick rant: &lt;/p&gt;
&lt;p&gt;why isn&amp;#39;t there Debug.WriteLine(string, params object[]) ?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665383" width="1" height="1"&gt;</description></item><item><title>re: Quick rant: why isn't there an Exception(string, params object[]) constructor?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2009/01/23/quick-rant-why-isn-t-there-an-exception-string-params-object-constructor.aspx#1665382</link><pubDate>Sat, 24 Jan 2009 08:51:17 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1665382</guid><dc:creator>Vincent Croquette</dc:creator><description>&lt;p&gt;I think Jesper&amp;#39;s has a point&lt;/p&gt;
&lt;p&gt;Formatting strings is a very common need, so common that shortcuts were sometimes implemented (Console.WriteLine...)&lt;/p&gt;
&lt;p&gt;Do you remember the time where we had to implement iterators the hard way (prior to yield return)?&lt;/p&gt;
&lt;p&gt;The C# team was smart enough to realize that yield was a very handy tool and decided to include it in the language. Same could apply here&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1665382" width="1" height="1"&gt;</description></item></channel></rss>