<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicious.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>ViNull, Off the Record - All Comments</title><link>http://devlicious.com/blogs/vinull/default.aspx</link><description>Distilled ramblings of &lt;a href="http://www.vinull.com/"&gt;Michael C. Neel&lt;/a&gt; delivered right to your browser.</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>The ASP.NET MVC Definition  &amp;laquo; Payed Coder</title><link>http://devlicious.com/blogs/vinull/archive/2008/07/26/the-asp-net-mvc-definition.aspx#43401</link><pubDate>Sat, 13 Dec 2008 15:45:22 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:43401</guid><dc:creator>The ASP.NET MVC Definition  « Payed Coder</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;The ASP.NET MVC Definition &amp;nbsp;&amp;amp;laquo; Payed Coder&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=43401" width="1" height="1"&gt;</description></item><item><title>re: SilverLight Interop with Flash/Flex (flashlight?)</title><link>http://devlicious.com/blogs/vinull/archive/2008/04/21/silverlight-interop-with-flash-flex-flashlight.aspx#43241</link><pubDate>Wed, 26 Nov 2008 15:14:14 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:43241</guid><dc:creator>webdesign</dc:creator><description>&lt;p&gt;Nice flash code! Thanks&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=43241" width="1" height="1"&gt;</description></item><item><title>re: Finding the difference between two Arrays, or un-LINQ-ing your code</title><link>http://devlicious.com/blogs/vinull/archive/2008/10/03/finding-the-difference-between-two-arrays-or-un-linq-ing-your-code.aspx#42602</link><pubDate>Wed, 08 Oct 2008 00:51:39 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:42602</guid><dc:creator>Kevin H</dc:creator><description>&lt;p&gt;Well, the DateTime timing isn't very good (15ms resolution, plus the GC might run, etc). I've re-timed it a few times, and it seems that your method is slightly better than the method in the post, is slightly better than Except. However, they are all orders of magnitude faster than the LINQ .contains version, and 500k entries take less than a couple hundred ms, which is significantly less time than it would take to actually load that amount of data from the file system or db.&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=42602" width="1" height="1"&gt;</description></item><item><title>re: Finding the difference between two Arrays, or un-LINQ-ing your code</title><link>http://devlicious.com/blogs/vinull/archive/2008/10/03/finding-the-difference-between-two-arrays-or-un-linq-ing-your-code.aspx#42577</link><pubDate>Sat, 04 Oct 2008 21:20:39 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:42577</guid><dc:creator>Bill</dc:creator><description>&lt;p&gt;The Except extension method is what you are looking for (though your solution is almost twice as fast because using the extension method you would be sorting the lists twice, contrary to the incorrect results suggested by Keven). My results on the comparison methods above are:&lt;/p&gt;
&lt;p&gt;ExceptMethod: 31.25ms&lt;/p&gt;
&lt;p&gt;MergeSortMethod: 15.625ms&lt;/p&gt;
&lt;p&gt;though I changed the instantiation for loops:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;static void Main(string[] args) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Random r = new Random(1);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;int&amp;gt; oldNumbers = Enumerable.Range(1, NumberOfSamples).Select(x =&amp;gt; r.Next(NumberOfSamples*2)).Distinct().ToList();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;int&amp;gt; newNumbers = Enumerable.Range(1, NumberOfSamples).Select(x =&amp;gt; r.Next(NumberOfSamples * 2)).Distinct().ToList();&lt;/p&gt;
&lt;p&gt;A slight improvement on your code would be (a couple of saved instructions per loop, we are talking microseconds of improvement here):&lt;/p&gt;
&lt;p&gt;var removed = new List&amp;lt;int&amp;gt;();&lt;/p&gt;
&lt;p&gt;var added = new List&amp;lt;int&amp;gt;();&lt;/p&gt;
&lt;p&gt;newNumbers.Sort();&lt;/p&gt;
&lt;p&gt;oldNumbers.Sort();&lt;/p&gt;
&lt;p&gt;int iE = 0, iI = 0, oldCount = oldNumbers.Count, newCount = newNumbers.Count;&lt;/p&gt;
&lt;p&gt;while (iE &amp;lt; oldCount &amp;amp;&amp;amp; iI &amp;lt; newCount) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;var diff = oldNumbers[iE].CompareTo(newNumbers[iI]);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;if (diff == 0) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iE++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iI++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;} else if (diff &amp;gt; 0) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;removed.Add(newNumbers[iI]);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iI++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;} else {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;added.Add(oldNumbers[iE]);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iE++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;if (iE &amp;gt;= oldCount) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;while (iI &amp;lt; newCount) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;removed.Add(newNumbers[iI]);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iI++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;} else if (iI &amp;gt;= newCount) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;while (iE &amp;lt; oldCount) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;added.Add(oldNumbers[iE]);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iE++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=42577" width="1" height="1"&gt;</description></item><item><title>Dew Drop - October 4, 2008 | Alvin Ashcraft's Morning Dew</title><link>http://devlicious.com/blogs/vinull/archive/2008/10/03/finding-the-difference-between-two-arrays-or-un-linq-ing-your-code.aspx#42575</link><pubDate>Sat, 04 Oct 2008 14:40:35 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:42575</guid><dc:creator>Dew Drop - October 4, 2008 | Alvin Ashcraft's Morning Dew</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;Dew Drop - October 4, 2008 | Alvin Ashcraft's Morning Dew&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=42575" width="1" height="1"&gt;</description></item><item><title>re: Finding the difference between two Arrays, or un-LINQ-ing your code</title><link>http://devlicious.com/blogs/vinull/archive/2008/10/03/finding-the-difference-between-two-arrays-or-un-linq-ing-your-code.aspx#42574</link><pubDate>Sat, 04 Oct 2008 09:54:18 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:42574</guid><dc:creator>charles</dc:creator><description>&lt;p&gt;I have to try this one.&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=42574" width="1" height="1"&gt;</description></item><item><title>re: Finding the difference between two Arrays, or un-LINQ-ing your code</title><link>http://devlicious.com/blogs/vinull/archive/2008/10/03/finding-the-difference-between-two-arrays-or-un-linq-ing-your-code.aspx#42573</link><pubDate>Fri, 03 Oct 2008 23:59:53 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:42573</guid><dc:creator>smaclell</dc:creator><description>&lt;p&gt;Since what you are doing appears to be filtering each list based on where they overlap you might want to check out the Intersects and Except extension methods.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://rsanidad.wordpress.com/2007/10/16/linq-except-and-intersect/"&gt;rsanidad.wordpress.com/.../linq-except-and-intersect&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Good luck.&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=42573" width="1" height="1"&gt;</description></item><item><title>re: Finding the difference between two Arrays, or un-LINQ-ing your code</title><link>http://devlicious.com/blogs/vinull/archive/2008/10/03/finding-the-difference-between-two-arrays-or-un-linq-ing-your-code.aspx#42572</link><pubDate>Fri, 03 Oct 2008 23:55:14 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:42572</guid><dc:creator>Kevin H</dc:creator><description>&lt;p&gt;There's always the .Except() method, which does what you want, and seems to be a little faster even than your mergesort (i'm guessing because it *is* a mergesort written unmanaged)&lt;/p&gt;
&lt;p&gt;Adding/removing 1000 out of&lt;/p&gt;
&lt;p&gt;Linq w/ contains: 17734.375ms&lt;/p&gt;
&lt;p&gt;Except: 15.625ms&lt;/p&gt;
&lt;p&gt;MergeSort: 46.875ms&lt;/p&gt;
&lt;p&gt;source code follows:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;class Program&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;const int NumberOfSamples = 50000;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;static void Main(string[] args)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Random r = new Random();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;int&amp;gt; oldNumbers = new List&amp;lt;int&amp;gt;();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;int&amp;gt; newNumbers = new List&amp;lt;int&amp;gt;();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (int i = 0; i &amp;lt; NumberOfSamples; i++)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oldNumbers.Add(r.Next());&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;newNumbers.AddRange(oldNumbers);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (int i = 0; i &amp;lt; 1000; i++)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;newNumbers.RemoveAt(r.Next(newNumbers.Count));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (int i = 0; i &amp;lt; 1000; i++)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;newNumbers.Add(r.Next());&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DateTime start;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;GC.Collect();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;start = DateTime.Now;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ContainsMethod(oldNumbers, newNumbers); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(&amp;quot;{0}ms&amp;quot;, (DateTime.Now - start).TotalMilliseconds);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;GC.Collect();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;start = DateTime.Now;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ExceptMethod(oldNumbers, newNumbers);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(&amp;quot;{0}ms&amp;quot;, (DateTime.Now - start).TotalMilliseconds);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;GC.Collect();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;start = DateTime.Now;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MergeSortMethod(oldNumbers, newNumbers);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(&amp;quot;{0}ms&amp;quot;, (DateTime.Now - start).TotalMilliseconds);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.ReadKey();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;static void ExceptMethod(List&amp;lt;int&amp;gt; oldNumbers, List&amp;lt;int&amp;gt; newNumbers)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;int&amp;gt; removed = oldNumbers.Except(newNumbers).ToList();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;int&amp;gt; added = newNumbers.Except(oldNumbers).ToList();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(&amp;quot;Removed: {0}, Added: {1}&amp;quot;, removed.Count, added.Count);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;static void ContainsMethod(List&amp;lt;int&amp;gt; oldNumbers, List&amp;lt;int&amp;gt; newNumbers)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;int&amp;gt; removed = (from f in oldNumbers&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where !newNumbers.Contains(f)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select f).ToList();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;int&amp;gt; added = (from f in newNumbers&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where !oldNumbers.Contains(f)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select f).ToList();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(&amp;quot;Removed: {0}, Added: {1}&amp;quot;, removed.Count, added.Count);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;static void MergeSortMethod(List&amp;lt;int&amp;gt; oldNumbers, List&amp;lt;int&amp;gt; newNumbers)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;int&amp;gt; removed = new List&amp;lt;int&amp;gt;();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;int&amp;gt; added = new List&amp;lt;int&amp;gt;();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;newNumbers.Sort();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oldNumbers.Sort();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (int iE = 0, iI = 0; iE &amp;lt; oldNumbers.Count || iI &amp;lt; newNumbers.Count; ) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (iE &amp;gt;= oldNumbers.Count) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;removed.Add(newNumbers[iI]);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iI++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else if (iI &amp;gt;= newNumbers.Count) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;added.Add(oldNumbers[iE]);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iE++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Int32 diff = oldNumbers[iE].CompareTo(newNumbers[iI]);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (diff == 0) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iE++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iI++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else if (diff &amp;gt; 0) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;removed.Add(newNumbers[iI]);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iI++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else if (diff &amp;lt; 0) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;added.Add(oldNumbers[iE]);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iE++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(&amp;quot;Removed: {0}, Added: {1}&amp;quot;, removed.Count, added.Count);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=42572" width="1" height="1"&gt;</description></item><item><title>re: Finding the difference between two Arrays, or un-LINQ-ing your code</title><link>http://devlicious.com/blogs/vinull/archive/2008/10/03/finding-the-difference-between-two-arrays-or-un-linq-ing-your-code.aspx#42571</link><pubDate>Fri, 03 Oct 2008 23:36:27 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:42571</guid><dc:creator>Carlos Beppler</dc:creator><description>&lt;p&gt;Try to use System.Collections.Generic.HashSet&amp;lt;T&amp;gt; instead of lists.&lt;/p&gt;
&lt;p&gt;To get an HashSet you can change the fist code to:&lt;/p&gt;
&lt;p&gt;HashSet&amp;lt;String&amp;gt; toAdd = new HashSet&amp;lt;string&amp;gt;(&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;from f in existingFiles&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;where !indexedFiles.Contains(f)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;select f).AsEnumerable() );&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=42571" width="1" height="1"&gt;</description></item><item><title>re: Finding the difference between two Arrays, or un-LINQ-ing your code</title><link>http://devlicious.com/blogs/vinull/archive/2008/10/03/finding-the-difference-between-two-arrays-or-un-linq-ing-your-code.aspx#42570</link><pubDate>Fri, 03 Oct 2008 22:42:28 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:42570</guid><dc:creator>LukeB</dc:creator><description>&lt;p&gt;Iesi.Collections.ISet&amp;lt;&amp;gt; is your friend.&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=42570" width="1" height="1"&gt;</description></item><item><title>Websites tagged "orm" on Postsaver</title><link>http://devlicious.com/blogs/vinull/archive/2008/08/03/using-linq-to-generate-html.aspx#42355</link><pubDate>Fri, 19 Sep 2008 08:17:29 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:42355</guid><dc:creator>Websites tagged "orm" on Postsaver</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;Websites tagged &amp;quot;orm&amp;quot; on Postsaver&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=42355" width="1" height="1"&gt;</description></item><item><title>re: Using LINQ to generate HTML</title><link>http://devlicious.com/blogs/vinull/archive/2008/08/03/using-linq-to-generate-html.aspx#41669</link><pubDate>Mon, 04 Aug 2008 18:26:19 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:41669</guid><dc:creator>Yuvi</dc:creator><description>&lt;p&gt;VB9's XML Literals ftw!&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=41669" width="1" height="1"&gt;</description></item><item><title>re: Using LINQ to generate HTML</title><link>http://devlicious.com/blogs/vinull/archive/2008/08/03/using-linq-to-generate-html.aspx#41667</link><pubDate>Mon, 04 Aug 2008 17:25:06 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:41667</guid><dc:creator>KevinI</dc:creator><description>&lt;p&gt;You should check out VB.Net XML Literals, it uses the LINQ with type strict syntax to take the exact code you made above and basically make it look like 'pure xml' (but type safe). &amp;nbsp;&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=41667" width="1" height="1"&gt;</description></item><item><title>Dew Drop - August 4, 2008 | Alvin Ashcraft's Morning Dew</title><link>http://devlicious.com/blogs/vinull/archive/2008/08/03/using-linq-to-generate-html.aspx#41659</link><pubDate>Mon, 04 Aug 2008 13:28:58 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:41659</guid><dc:creator>Dew Drop - August 4, 2008 | Alvin Ashcraft's Morning Dew</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;Dew Drop - August 4, 2008 | Alvin Ashcraft's Morning Dew&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=41659" width="1" height="1"&gt;</description></item><item><title>re: Using LINQ to generate HTML</title><link>http://devlicious.com/blogs/vinull/archive/2008/08/03/using-linq-to-generate-html.aspx#41646</link><pubDate>Sun, 03 Aug 2008 19:48:28 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:41646</guid><dc:creator>Nicholas Piasecki</dc:creator><description>&lt;p&gt;I have no problem mixing code with markup, particularly little if/else checks on template pages, as long as that code is presentation code. This usage of LINQ isn't really creating any separation, just obfuscating it. After all, at the end of the day, *some* code is going to spit out the string ... which method will be easier for a maintenance programmer to modify six months down the road is a stylistic preference that is open to debate. Just my two cents.&lt;/p&gt;
&lt;img src="http://devlicious.com/aggbug.aspx?PostID=41646" width="1" height="1"&gt;</description></item></channel></rss>