Another ALT.NET guy at Microsoft
This evening I was writing some code (Yay!) for an Xml based MEF catalog I am prototyping. I came across the need to invoke a set of methods on an IEnumerable<T> that was returned from a LINQ to XML query. Unfortunately no such animal exists on IEnumerable.
It took me < 5 mins to write this
1: public static class IEnumerableUtils
2: {
3: public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action)
4: {
5: foreach(T item in collection)
6: action(item);
7: }
8: }
Any questions?
About Glenn Block
Glenn is a PM for the new Managed Extensibility Framework in .NET 4.0. Prior to Microsoft, he worked for 10 years in various startups and ISVs wearing many different hats all related to developing software. Glenn has been writing code practically since the time he learned how to ride a bicycle. When he's not writing code, he's continuously improving on ways to build better software. Glenn is a geek at heart and spends a good portion of the rest of this time spreading that geekdom through conferences, and the community through groups such as ALT.NET. When he's not working and playing with technology, he spends his time with his wife and four year old daughter either at their Seattle apartment or at one of the local coffee shops.