title: Linq join 2 different list with one commonality
body: <p>I have two lists from two different tables, name can common in both, but second value has to remain unique. I want to throw them into one class list:</p>
  <pre><code>public class Selected
  {
      public string Name { get; set; }
      public bool Collected { get; set; }
      public bool Transferred { get; set; }
  }
  
  var collected = await (from nc in namescollected where parentid = id
                         select new Selected {Name = nc.Name, Collected = true}).ToListAsync();
  
  var transferred = await (from nt in namestransferred where parentid = id
                           select new Selected {Name = nt.Name, Transferred = true}).ToListAsync();
  </code></pre>
  <p>I would like to combine them into one by taking the 2 lists:</p>
  <p>Collected:</p>
  <pre><code>Name = NY, collected= true;
  Name = NH, collected= true;
  Name = NC, collected= true;
  Name = FL, collected= true;
  </code></pre>
  <p>Transferred:</p>
  <pre><code>Name = NY, Transferred = true;
  Name = VA, Transferred = true;
  Name = CO, Transferred = true;
  Name = FL, Transferred = true;
  </code></pre>
  <p>Merge into the list selected class:</p>
  <pre><code>Name = NY, Collected = true, Transferred = true;
  Name = NH, collected= true, Transferred = false;
  Name = NC, collected= true, Transferred = false;
  Name = VA, collected= false, Transferred = true;
  Name = CO, collected= false, Transferred = true;
  Name = FL, collected= true, Transferred = true;
  </code></pre>
  <p>I can add the ones from the second list that are missing from first list:</p>
  <pre><code>var newItems = transferred.Where(x =&gt; !collected.Any(y =&gt; x.Name== y.Name));
  
  foreach (var item in newItems)
  {
      collected.Add(new Selected { Name = item.Name, Transferred = item.Transferred });
  }
  </code></pre>
  <p>But that only adds the missing ones, I now need to go back through the list and make sure existing ones have the 'transferred' status assigned.</p>
  <p>My brain is currently broken and this can probably be streamlined but I'm not seeing it right now.</p>
  <p>Any help appreciated.</p>