<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Extended LINQ: additional operators for LINQ to objects</title>
	<atom:link href="http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/feed/" rel="self" type="application/rss+xml" />
	<link>http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/</link>
	<description>On programming, technology, and random things of interest</description>
	<lastBuildDate>Thu, 29 Jul 2010 00:28:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: LINQ Tips and Tricks &#171; NetInverse Developers Blog</title>
		<link>http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/comment-page-1/#comment-532</link>
		<dc:creator>LINQ Tips and Tricks &#171; NetInverse Developers Blog</dc:creator>
		<pubDate>Fri, 19 Jun 2009 07:22:45 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/#comment-532</guid>
		<description></description>
		<content:encoded><![CDATA[<p>[...] Â If you have your own bag of LINQ tricks, please share them in the comments! Also, if you like this article, you may like my next article, Extended LINQ: additional operators for LINQ to objects. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryp</title>
		<link>http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/comment-page-1/#comment-352</link>
		<dc:creator>ryp</dc:creator>
		<pubDate>Wed, 10 Sep 2008 08:08:57 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/#comment-352</guid>
		<description>@Igor Ostrovsky

Thanks, I have changed it to:

return source.Aggregate(new StringBuilder(before), (workingSentence, next) =&gt; workingSentence.Length &gt; before.Length ? workingSentence.Append(delimiter).Append(next) : workingSentence.Append(next)).Append(after).ToString();</description>
		<content:encoded><![CDATA[<p>@Igor Ostrovsky</p>
<p>Thanks, I have changed it to:</p>
<p>return source.Aggregate(new StringBuilder(before), (workingSentence, next) =&gt; workingSentence.Length &gt; before.Length ? workingSentence.Append(delimiter).Append(next) : workingSentence.Append(next)).Append(after).ToString();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor Ostrovsky</title>
		<link>http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/comment-page-1/#comment-351</link>
		<dc:creator>Igor Ostrovsky</dc:creator>
		<pubDate>Wed, 10 Sep 2008 07:51:44 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/#comment-351</guid>
		<description>@ryp: Glad you like the article!

Your implementation is more clever than the one I have. It is less efficient, but that could be fixed by rewriting the Aggregate to use a StringBuilder.

To fix the compile error, you need to use a Select to convert from an int to a string. Cast operator does not work in this context.

Try this:

return before + source.Select(x =&gt; x.ToString()).Aggregate((workingSentence, next) =&gt; workingSentence + delimiter + next) + after;</description>
		<content:encoded><![CDATA[<p>@ryp: Glad you like the article!</p>
<p>Your implementation is more clever than the one I have. It is less efficient, but that could be fixed by rewriting the Aggregate to use a StringBuilder.</p>
<p>To fix the compile error, you need to use a Select to convert from an int to a string. Cast operator does not work in this context.</p>
<p>Try this:</p>
<p>return before + source.Select(x =&gt; x.ToString()).Aggregate((workingSentence, next) =&gt; workingSentence + delimiter + next) + after;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryp</title>
		<link>http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/comment-page-1/#comment-350</link>
		<dc:creator>ryp</dc:creator>
		<pubDate>Wed, 10 Sep 2008 07:40:31 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/#comment-350</guid>
		<description>Hi! Great article as usual .

I have a question though, I am looking at: public static string ToStringPretty(this IEnumerable source, string before, string delimiter, string after)

and cannot figure why it isn&#039;t possible to change whole function to something like this:

return before + source.Cast().Aggregate((workingSentence, next) =&gt; next + &quot; &quot; + workingSentence) + after;

At debugger I receive the following error: 

 System.InvalidCastException was unhandled
  Message=&quot;Unable to cast object of type &#039;System.Int32&#039; to type &#039;System.String&#039;.&quot;
 
I know it&#039;s not your code, but may be you can help me to figure this out, and perhaps we can enhance your library.

Thanks in advance.</description>
		<content:encoded><![CDATA[<p>Hi! Great article as usual .</p>
<p>I have a question though, I am looking at: public static string ToStringPretty(this IEnumerable source, string before, string delimiter, string after)</p>
<p>and cannot figure why it isn&#8217;t possible to change whole function to something like this:</p>
<p>return before + source.Cast().Aggregate((workingSentence, next) =&gt; next + &#8221; &#8221; + workingSentence) + after;</p>
<p>At debugger I receive the following error: </p>
<p> System.InvalidCastException was unhandled<br />
  Message=&#8221;Unable to cast object of type &#8216;System.Int32&#8242; to type &#8216;System.String&#8217;.&#8221;</p>
<p>I know it&#8217;s not your code, but may be you can help me to figure this out, and perhaps we can enhance your library.</p>
<p>Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hal Pierson</title>
		<link>http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/comment-page-1/#comment-290</link>
		<dc:creator>Hal Pierson</dc:creator>
		<pubDate>Mon, 09 Jun 2008 16:24:12 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/#comment-290</guid>
		<description>In conjunction with

    public static IEnumerable ReadLinesFrom(TextReader reader)

I often use

    public static IEnumerable 
           CSV(this IEnumerable lines)

That converts comma separated fields into a string[].

By writing a class&#039; ToString() function to generate a comma separated string; and a constructor that takes a matching string[] parameter; I have an simple serialization/de-serialization mechanism.

        Hal Pierson

P.S. The separator doesn&#039;t have to be a comma.  But you do have to have a strategy for string fields that coould contain the seperator.</description>
		<content:encoded><![CDATA[<p>In conjunction with</p>
<p>    public static IEnumerable ReadLinesFrom(TextReader reader)</p>
<p>I often use</p>
<p>    public static IEnumerable<br />
           CSV(this IEnumerable lines)</p>
<p>That converts comma separated fields into a string[].</p>
<p>By writing a class&#8217; ToString() function to generate a comma separated string; and a constructor that takes a matching string[] parameter; I have an simple serialization/de-serialization mechanism.</p>
<p>        Hal Pierson</p>
<p>P.S. The separator doesn&#8217;t have to be a comma.  But you do have to have a strategy for string fields that coould contain the seperator.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcel Popescu</title>
		<link>http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/comment-page-1/#comment-284</link>
		<dc:creator>Marcel Popescu</dc:creator>
		<pubDate>Wed, 04 Jun 2008 21:33:30 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/#comment-284</guid>
		<description>Yes, the article was interesting, it&#039;s just that it&#039;s annoying when I see typos in code. I bet you find it annoying when you read other people&#039;s articles / blogs too :) Sorry about the tone, though.</description>
		<content:encoded><![CDATA[<p>Yes, the article was interesting, it&#8217;s just that it&#8217;s annoying when I see typos in code. I bet you find it annoying when you read other people&#8217;s articles / blogs too <img src='http://igoro.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Sorry about the tone, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor Ostrovsky</title>
		<link>http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/comment-page-1/#comment-283</link>
		<dc:creator>Igor Ostrovsky</dc:creator>
		<pubDate>Wed, 04 Jun 2008 16:15:32 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/#comment-283</guid>
		<description>&lt;p&gt;Marcel: Good catch. Fixed.&lt;/p&gt;
&lt;p&gt;By the way, I may be misreading your tone, but it seems kind of harsh. Typos like this one are notoriously easy to make when writing an article. You paste in your code, but then have to reformat it later, move stuff around, rename variables... It is easy to make a mistake. Also, keep in mind that writing blog posts is something I do for fun on my weekends.&lt;/p&gt;
&lt;p&gt;Either way, I hope you enjoyed the article. Thanks for reading!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Marcel: Good catch. Fixed.</p>
<p>By the way, I may be misreading your tone, but it seems kind of harsh. Typos like this one are notoriously easy to make when writing an article. You paste in your code, but then have to reformat it later, move stuff around, rename variables&#8230; It is easy to make a mistake. Also, keep in mind that writing blog posts is something I do for fun on my weekends.</p>
<p>Either way, I hope you enjoyed the article. Thanks for reading!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcel Popescu</title>
		<link>http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/comment-page-1/#comment-282</link>
		<dc:creator>Marcel Popescu</dc:creator>
		<pubDate>Wed, 04 Jun 2008 08:22:12 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/#comment-282</guid>
		<description>static void Grep(string inputFile, string outputFile, string substring)
{
    ExtendedEnumerable.ReadLinesFromFile(inputFile)
        .Where(line =&gt; line.Contains(word))
        .WriteLinesToFile(outputFile);
}

It would be really useful if you only pasted code that actually compiles... you&#039;re using word instead of substring here.</description>
		<content:encoded><![CDATA[<p>static void Grep(string inputFile, string outputFile, string substring)<br />
{<br />
    ExtendedEnumerable.ReadLinesFromFile(inputFile)<br />
        .Where(line =&gt; line.Contains(word))<br />
        .WriteLinesToFile(outputFile);<br />
}</p>
<p>It would be really useful if you only pasted code that actually compiles&#8230; you&#8217;re using word instead of substring here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #103</title>
		<link>http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/comment-page-1/#comment-272</link>
		<dc:creator>Reflective Perspective - Chris Alcock &#187; The Morning Brew #103</dc:creator>
		<pubDate>Thu, 29 May 2008 07:10:29 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/#comment-272</guid>
		<description>[...] Extended LINQ: additional operators for LINQ to objects - Igor Ostrovsky offers a collection of extension method operators for LINQ to objects [...]</description>
		<content:encoded><![CDATA[<p>[...] Extended LINQ: additional operators for LINQ to objects &#8211; Igor Ostrovsky offers a collection of extension method operators for LINQ to objects [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 7 tricks to simplify your programs with LINQ &#124; Igor Ostrovsky Blogging</title>
		<link>http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/comment-page-1/#comment-271</link>
		<dc:creator>7 tricks to simplify your programs with LINQ &#124; Igor Ostrovsky Blogging</dc:creator>
		<pubDate>Tue, 27 May 2008 21:18:09 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/archive/extended-linq-additional-operators-for-linq-to-objects/#comment-271</guid>
		<description>[...] If you have your own bag of LINQ tricks, please share them in the comments! Also, if you like this article, you may like my next article, Extended LINQ: additional operators for LINQ to objects. [...]</description>
		<content:encoded><![CDATA[<p>[...] If you have your own bag of LINQ tricks, please share them in the comments! Also, if you like this article, you may like my next article, Extended LINQ: additional operators for LINQ to objects. [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
