So here’s a recent MSDN article that I actually had the chance of reviewing several months ago. They’ve done a much better job at capturing the good new stuff in C# than I could ever do.
I do still have a few personal corrections:
I commented that the internal names that the compiler generates have changed and will probably change again, and so the article should probably just mention that the name is compiler generated and not give the actual name (those that care can run ILDASM and see for themselves), but they didn’t listen. At least they did mention that is might change. For those of you who have the community drop you’ll notice that the compiler generated names have changed from what’s in the article.
I also commented that using the binary tree wasn’t exactly the best example of iterators because of it’s miserable performance. Yes it is clean and neat code, but if you have a binary tree with 5000 nodes and you foreach it a few times, you can watch your machine crawl as it is forced to spend more and more time in the GC rather than running your code. At least they mentioned this potential problem (see the last paragraph before the Partial Types section). Too bad my brain wasn’t thinking and I got the numbers wrong. It should state, “approximately n
/2 iterator instantiations, where n is the number of nodes in the tree.”
Also note the small paragraph on #pragma warning that now gives you line-level control over individual warnings!