Geeks With Blogs
John Conwell: aka Turbo Research in the visual exploration of data May 2008 Entries
No more null checking on your IEnumerables before you iterate over them
I get a bit sick of checking for null on my IEnumerable objects before doing a foreach over them. In my opinion I think the CLR should check if the list is null, and if it is just exit out of the foreach iteration as if there were no items in it. Well, I was goofing around with Extension Methods a bit and figured out how to get this kind of functionality (sort of). Now unfortunatly Extension Methods cant override an existing method on a type, so I cant just create a new GetEnumerator extension method ......

Posted On Thursday, May 29, 2008 4:14 PM

Copyright © John Conwell | Powered by: