LINQ — choosing between Concat() and Union()

In Linq To Objects, there are two ways you can join two sequences togeth­er, using either Con­cat() or Union(), and as I was won­der­ing how the two dif­fers I came across this post:

http://weblogs.asp.net/fbouma/archive/2009/03/04/choose-concat-over-union-if-possible.aspx

The main thing to take away from this arti­cle is:

If you care about the dupli­cates, Union() is nec­es­sary. How­ev­er, in the case where you can’t have dupli­cates in the sec­ond sequence or you don’t care, Con­cat() is a bet­ter choice.”

Think­ing in T-SQL terms:

Con­cat() = UNION ALL

Union() = UNION

Join­ing two sequences using Union()

If by some chance you’re look­ing to join two poten­tial­ly dupli­cat­ed lists togeth­er, and you don’t want dupli­cates in the result­ing list, see this ques­tion on Stack­Over­flow and see Jon Skeet’s answer for a nice and clean way to do this:

http://stackoverflow.com/questions/590991/merging-two-ienumerablets