<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>ForEach, a simple but very useful extension method</title><link>http://blogs.msdn.com/gblock/archive/2008/08/19/foreach-a-simple-but-very-useful-extension-method.aspx</link><description>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&amp;lt;T&amp;gt; that was returned from a LINQ to XML query. Unfortunately no such animal exists on</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>discount furniture &amp;raquo; ForEach, a simple but very useful extension method</title><link>http://blogs.msdn.com/gblock/archive/2008/08/19/foreach-a-simple-but-very-useful-extension-method.aspx#8878133</link><pubDate>Tue, 19 Aug 2008 10:51:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8878133</guid><dc:creator>discount furniture &amp;raquo; ForEach, a simple but very useful extension method</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://informationsfunnywallpaper.cn/?p=1189"&gt;http://informationsfunnywallpaper.cn/?p=1189&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: ForEach, a simple but very useful extension method</title><link>http://blogs.msdn.com/gblock/archive/2008/08/19/foreach-a-simple-but-very-useful-extension-method.aspx#8878215</link><pubDate>Tue, 19 Aug 2008 11:22:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8878215</guid><dc:creator>Krzysztof Koźmic</dc:creator><description>&lt;p&gt;You're not checking for nulls :)&lt;/p&gt;
&lt;p&gt;Other than that - similar method has been on my Utils.dll library for a long time now. It should have been in the framework in the first place.&lt;/p&gt;
</description></item><item><title>re: ForEach, a simple but very useful extension method</title><link>http://blogs.msdn.com/gblock/archive/2008/08/19/foreach-a-simple-but-very-useful-extension-method.aspx#8878599</link><pubDate>Tue, 19 Aug 2008 15:20:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8878599</guid><dc:creator>Miguel Madero</dc:creator><description>&lt;p&gt;It's there for List&amp;lt;T&amp;gt; since 2.0&lt;/p&gt;
&lt;p&gt;some of those methods should've been refactored down as IEnumerable&amp;lt;T&amp;gt; extensions&lt;/p&gt;
</description></item><item><title>re: ForEach, a simple but very useful extension method</title><link>http://blogs.msdn.com/gblock/archive/2008/08/19/foreach-a-simple-but-very-useful-extension-method.aspx#8878705</link><pubDate>Tue, 19 Aug 2008 16:27:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8878705</guid><dc:creator>Mike Brown</dc:creator><description>&lt;p&gt;Was too lazy to do it myself so I just cheated and used Let ;)&lt;/p&gt;
</description></item><item><title>re: ForEach, a simple but very useful extension method</title><link>http://blogs.msdn.com/gblock/archive/2008/08/19/foreach-a-simple-but-very-useful-extension-method.aspx#8881660</link><pubDate>Wed, 20 Aug 2008 20:25:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8881660</guid><dc:creator>Paul</dc:creator><description>&lt;p&gt;I'm missing the point I guess - but why is this usefull over just using the foreach() w/o the extension?&lt;/p&gt;
</description></item><item><title>re: ForEach, a simple but very useful extension method</title><link>http://blogs.msdn.com/gblock/archive/2008/08/19/foreach-a-simple-but-very-useful-extension-method.aspx#8885476</link><pubDate>Thu, 21 Aug 2008 20:16:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8885476</guid><dc:creator>JamesCurran</dc:creator><description>&lt;p&gt;@Paul&lt;/p&gt;
&lt;p&gt;Given:&lt;/p&gt;
&lt;p&gt;List&amp;lt;string&amp;gt; titles = ....&lt;/p&gt;
&lt;p&gt;You could:&lt;/p&gt;
&lt;p&gt;foreach(string title in titles)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;title = title.ToUpperCase();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Or you could:&lt;/p&gt;
&lt;p&gt;titles.ForEach(t =&amp;gt; t=t.ToUpperCase());&lt;/p&gt;
</description></item><item><title>re: ForEach, a simple but very useful extension method</title><link>http://blogs.msdn.com/gblock/archive/2008/08/19/foreach-a-simple-but-very-useful-extension-method.aspx#8885477</link><pubDate>Thu, 21 Aug 2008 20:17:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8885477</guid><dc:creator>JamesCurran</dc:creator><description>&lt;p&gt;I'd suggest making it:&lt;/p&gt;
&lt;p&gt;public static IEnumerable&amp;lt;T&amp;gt; ForEach&amp;lt;T&amp;gt;(this IEnumerable&amp;lt;T&amp;gt; collection, Action&amp;lt;T&amp;gt; action)&lt;/p&gt;
&lt;p&gt;{...&lt;/p&gt;
&lt;p&gt; &amp;nbsp;return collection;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;so you could chain them.&lt;/p&gt;
</description></item><item><title>Playing with Extension Methods - also explaining why they are dangerous!</title><link>http://blogs.msdn.com/gblock/archive/2008/08/19/foreach-a-simple-but-very-useful-extension-method.aspx#8972442</link><pubDate>Thu, 02 Oct 2008 02:51:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8972442</guid><dc:creator>Techie.notepad</dc:creator><description>&lt;p&gt;Playing with Extension Methods - also explaining why they are dangerous!&lt;/p&gt;
</description></item><item><title>ForEach</title><link>http://blogs.msdn.com/gblock/archive/2008/08/19/foreach-a-simple-but-very-useful-extension-method.aspx#9387914</link><pubDate>Sun, 01 Feb 2009 10:41:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9387914</guid><dc:creator>Kirill Osenkov</dc:creator><description>&lt;p&gt;In my recent post about coding styles one particular thing provoked the majority of feedback and discussions:&lt;/p&gt;
</description></item><item><title>re: ForEach, a simple but very useful extension method</title><link>http://blogs.msdn.com/gblock/archive/2008/08/19/foreach-a-simple-but-very-useful-extension-method.aspx#9891312</link><pubDate>Fri, 04 Sep 2009 13:11:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9891312</guid><dc:creator>Magnus</dc:creator><description>&lt;p&gt;foreach(var t in titles) t = t.ToUpperCase();&lt;/p&gt;
&lt;p&gt;titles.ForEach(t =&amp;gt; t = t.ToUpperCase());&lt;/p&gt;
&lt;p&gt;Not much difference...&lt;/p&gt;</description></item></channel></rss>