title: C# linq union question
body: <p>Could someone explain how does <code>Union</code> in LINQ work?</p>
  
  <p>It is told that it merges two sequences and <em>removes duplicates.</em></p>
  
  <p>But can I somehow customize the duplicate removal behavior - let's say if I wish to use the element from <code>the second sequence</code> in case of duplicate or from <code>the first sequence</code>.</p>
  
  <p>Or even if I wish to somehow combine those values in the resulting sequence?</p>
  
  <p><em>How should that be implemented?</em></p>
  
  <hr>
  
  <h2>Update</h2>
  
  <p>I guess I described the problem incorrectly, let's say we have some value:</p>
  
  <pre><code>class Value {
     String name
     Int whatever;
  }
  </code></pre>
  
  <p>and the comparer used performs a <code>x.name == y.name</code> check.</p>
  
  <p>And let's say that sometimes I know I should take the element from the second sequence, because it's <code>whatever</code> field is newer / better than the <code>whatever</code> field of the first sequence. </p>
  
  <p><strong>Anyway, I would use the <code>sequence1.Union(sequence2)</code> or <code>sequence2.Union(sequence1)</code> variation of the methods.</strong></p>
  
  <p>Thank you</p>