<?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: Readability, Sub-Queries in LINQ</title>
	<atom:link href="http://www.chadscharf.com/index.php/2008/03/readability-sub-queries-in-linq/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chadscharf.com/index.php/2008/03/readability-sub-queries-in-linq/</link>
	<description>It&#039;s always time to upgrade!</description>
	<lastBuildDate>Thu, 15 Jul 2010 04:53:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Steve</title>
		<link>http://www.chadscharf.com/index.php/2008/03/readability-sub-queries-in-linq/comment-page-1/#comment-848</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Fri, 28 May 2010 11:44:44 +0000</pubDate>
		<guid isPermaLink="false">http://chadscharf.com/post.aspx?id=142938bb-425a-4c87-996e-eff575e58117#comment-848</guid>
		<description>Me Like! 

Thanks for the writeup.   Linq2Sql is quite flexible. Didn&#039;t think about doing it in the &quot;select new{}&quot; way. Good idea.

I was thinking about doing an &quot;in&quot; or &quot;contains&quot; style operator for seeing if a record contains information from another related table.. but this was good info to know.</description>
		<content:encoded><![CDATA[<p>Me Like! </p>
<p>Thanks for the writeup.   Linq2Sql is quite flexible. Didn&#8217;t think about doing it in the &#8220;select new{}&#8221; way. Good idea.</p>
<p>I was thinking about doing an &#8220;in&#8221; or &#8220;contains&#8221; style operator for seeing if a record contains information from another related table.. but this was good info to know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce</title>
		<link>http://www.chadscharf.com/index.php/2008/03/readability-sub-queries-in-linq/comment-page-1/#comment-775</link>
		<dc:creator>Bruce</dc:creator>
		<pubDate>Wed, 19 May 2010 20:35:09 +0000</pubDate>
		<guid isPermaLink="false">http://chadscharf.com/post.aspx?id=142938bb-425a-4c87-996e-eff575e58117#comment-775</guid>
		<description>Me Like! 

Thanks for the writeup.   Linq2Sql is quite flexible. Didn&#039;t think about doing it in the &quot;select new{}&quot; way. Good idea.

I was thinking about doing an &quot;in&quot; or &quot;contains&quot; style operator for seeing if a record contains information from another related table.. but this was good info to know.</description>
		<content:encoded><![CDATA[<p>Me Like! </p>
<p>Thanks for the writeup.   Linq2Sql is quite flexible. Didn&#8217;t think about doing it in the &#8220;select new{}&#8221; way. Good idea.</p>
<p>I was thinking about doing an &#8220;in&#8221; or &#8220;contains&#8221; style operator for seeing if a record contains information from another related table.. but this was good info to know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DaryFademem</title>
		<link>http://www.chadscharf.com/index.php/2008/03/readability-sub-queries-in-linq/comment-page-1/#comment-296</link>
		<dc:creator>DaryFademem</dc:creator>
		<pubDate>Sun, 01 Nov 2009 20:33:48 +0000</pubDate>
		<guid isPermaLink="false">http://chadscharf.com/post.aspx?id=142938bb-425a-4c87-996e-eff575e58117#comment-296</guid>
		<description>Other variant is possible also</description>
		<content:encoded><![CDATA[<p>Other variant is possible also</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chad</title>
		<link>http://www.chadscharf.com/index.php/2008/03/readability-sub-queries-in-linq/comment-page-1/#comment-237</link>
		<dc:creator>Chad</dc:creator>
		<pubDate>Fri, 02 Oct 2009 03:40:13 +0000</pubDate>
		<guid isPermaLink="false">http://chadscharf.com/post.aspx?id=142938bb-425a-4c87-996e-eff575e58117#comment-237</guid>
		<description>I see the direction you&#039;re going and I can&#039;t argue that this may be more legible from a readability standpoint by breaking up the subquery as an IQueryable&lt;T&gt;, then assigning the &quot;var&quot; to the Commission property in the actual select statement. My assumption (without validation of course) would be that you would end up with the exact same SQL output, which any optimizing tricks you can use when LINQ is generating your SQL and not you the better.

Of course, my idea of readability is putting everything humanly possible in a single statement (or single line if I can get away with it). I hate vertical space ;-). This was a good suggestion though, thanks!</description>
		<content:encoded><![CDATA[<p>I see the direction you&#8217;re going and I can&#8217;t argue that this may be more legible from a readability standpoint by breaking up the subquery as an IQueryable<t>, then assigning the &#8220;var&#8221; to the Commission property in the actual select statement. My assumption (without validation of course) would be that you would end up with the exact same SQL output, which any optimizing tricks you can use when LINQ is generating your SQL and not you the better.</p>
<p>Of course, my idea of readability is putting everything humanly possible in a single statement (or single line if I can get away with it). I hate vertical space <img src='http://www.chadscharf.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . This was a good suggestion though, thanks!</t></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.chadscharf.com/index.php/2008/03/readability-sub-queries-in-linq/comment-page-1/#comment-234</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Thu, 01 Oct 2009 05:14:24 +0000</pubDate>
		<guid isPermaLink="false">http://chadscharf.com/post.aspx?id=142938bb-425a-4c87-996e-eff575e58117#comment-234</guid>
		<description>If you talk about readability i would split it up into 2 queries 
var qcommision = from t in e.Orders 
                                     where t.ShippedDate.HasValue &amp;&amp; t.ShippedDate  (r.Quantity * r.UnitPrice) – Convert.ToDecimal(r.Discount)) * .1M).Sum(r =&gt; r) 

and then

var employees = from e in northwind.Employees 
     select new 
     { 
     FirstName = e.FirstName, 
     LastName = e.LastName, 
     Title = e.Title, 
     Commission = qcommision
     }

haven&#039;t tested this but it think it would work this way also.</description>
		<content:encoded><![CDATA[<p>If you talk about readability i would split it up into 2 queries<br />
var qcommision = from t in e.Orders<br />
                                     where t.ShippedDate.HasValue &amp;&amp; t.ShippedDate  (r.Quantity * r.UnitPrice) – Convert.ToDecimal(r.Discount)) * .1M).Sum(r =&gt; r) </p>
<p>and then</p>
<p>var employees = from e in northwind.Employees<br />
     select new<br />
     {<br />
     FirstName = e.FirstName,<br />
     LastName = e.LastName,<br />
     Title = e.Title,<br />
     Commission = qcommision<br />
     }</p>
<p>haven&#8217;t tested this but it think it would work this way also.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Travis</title>
		<link>http://www.chadscharf.com/index.php/2008/03/readability-sub-queries-in-linq/comment-page-1/#comment-96</link>
		<dc:creator>Travis</dc:creator>
		<pubDate>Tue, 04 Aug 2009 01:22:07 +0000</pubDate>
		<guid isPermaLink="false">http://chadscharf.com/post.aspx?id=142938bb-425a-4c87-996e-eff575e58117#comment-96</guid>
		<description>Me Like! 

Thanks for the writeup.   Linq2Sql is quite flexible. Didn&#039;t think about doing it in the &quot;select new{}&quot; way. Good idea.

I was thinking about doing an &quot;in&quot; or &quot;contains&quot; style operator for seeing if a record contains information from another related table.. but this was good info to know.</description>
		<content:encoded><![CDATA[<p>Me Like! </p>
<p>Thanks for the writeup.   Linq2Sql is quite flexible. Didn&#8217;t think about doing it in the &#8220;select new{}&#8221; way. Good idea.</p>
<p>I was thinking about doing an &#8220;in&#8221; or &#8220;contains&#8221; style operator for seeing if a record contains information from another related table.. but this was good info to know.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><a href="http://www.hosting24.com/"><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->
