<?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: LINQ: Combine elements in nested collection</title>
	<atom:link href="http://www.codemeit.com/linq/linq-combine-elements-in-nested-collection.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codemeit.com/linq/linq-combine-elements-in-nested-collection.html</link>
	<description>programming, software &#38; problem solving</description>
	<lastBuildDate>Fri, 10 Sep 2010 10:12:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Nick Olsen</title>
		<link>http://www.codemeit.com/linq/linq-combine-elements-in-nested-collection.html/comment-page-1#comment-7028</link>
		<dc:creator>Nick Olsen</dc:creator>
		<pubDate>Wed, 14 Jul 2010 15:14:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/linq/linq-combine-elements-in-nested-collection.html#comment-7028</guid>
		<description>Perfect.  Exactly what I needed.  Thanks!</description>
		<content:encoded><![CDATA[<p>Perfect.  Exactly what I needed.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua</title>
		<link>http://www.codemeit.com/linq/linq-combine-elements-in-nested-collection.html/comment-page-1#comment-2586</link>
		<dc:creator>Joshua</dc:creator>
		<pubDate>Fri, 04 Sep 2009 19:41:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/linq/linq-combine-elements-in-nested-collection.html#comment-2586</guid>
		<description>Awesome! This is just what I was looking for. I originally had the nested foreach&#039;s that you also listed.

I think it&#039;s more elegant to have

List neededCourses =
(from courseObject in students.Select(stu =&gt; stu.Value.Courses)
from individualCRN in courseObject
select individualCRN).Distinct().OrderBy(crn =&gt; crn).ToList();

than to have

var allCourses = students.Select(x =&gt; x.Value.Courses);
List neededCourses = new List();
foreach (var crse in allCourses)
{
 foreach (int crn in crse)
  neededCourses.Add(crn);
}
neededCourses = neededCourses.Distinct().OrderBy(x =&gt; x).ToList();

So I just wanted to say thanks!</description>
		<content:encoded><![CDATA[<p>Awesome! This is just what I was looking for. I originally had the nested foreach&#8217;s that you also listed.</p>
<p>I think it&#8217;s more elegant to have</p>
<p>List neededCourses =<br />
(from courseObject in students.Select(stu =&gt; stu.Value.Courses)<br />
from individualCRN in courseObject<br />
select individualCRN).Distinct().OrderBy(crn =&gt; crn).ToList();</p>
<p>than to have</p>
<p>var allCourses = students.Select(x =&gt; x.Value.Courses);<br />
List neededCourses = new List();<br />
foreach (var crse in allCourses)<br />
{<br />
 foreach (int crn in crse)<br />
  neededCourses.Add(crn);<br />
}<br />
neededCourses = neededCourses.Distinct().OrderBy(x =&gt; x).ToList();</p>
<p>So I just wanted to say thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://www.codemeit.com/linq/linq-combine-elements-in-nested-collection.html/comment-page-1#comment-89</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Thu, 30 Oct 2008 15:50:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/linq/linq-combine-elements-in-nested-collection.html#comment-89</guid>
		<description>Thanks for this clear sample for nested collections. Found you via Google on top spot for &quot;linq+nested+collection&quot; and answered my query straight away.</description>
		<content:encoded><![CDATA[<p>Thanks for this clear sample for nested collections. Found you via Google on top spot for &#8220;linq+nested+collection&#8221; and answered my query straight away.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
