Join two collections, taking the value from second collection (left outer join)

Say I have two List<KeyValuePair<string, string>> a and b where a =

"one", "N",
"two", "N",
"three", "N"

and b =

"one", "Y"
"two", "N"

I want to do a left outer join, but take the value from b for the Value if there is an entry in b, so the result should be =

"one", "Y" <- this value is taken from b
"two", "N",
"three", "N"

I've tried doing a normal left outer join, but the result for the Value of "three" is always a blank string

    var res = (from l in a
              join r in b on l.Key equals r.Key into lrs
              from lr in lrs.DefaultIfEmpty()
              select new KeyValuePair<string, string>(l.Key, lr.Value)).ToArray();


This should work too:

var res = (from p in b.Concat(a)
           group p by p.Key into g
           select g.First()).ToArray();

Or in fluent syntax:

var res = b.Concat(a).GroupBy(p => p.Key, (k, g) => g.First()).ToArray();

Need Your Help

Can I launch a trigger on select statement in mysql?

mysql database triggers

I am trying to run an INSERT statement on table X each time I SELECT any record from table Y is there anyway that I can accomplish that using MySQL only?

Eclipse Egit automatically pull changes to local branch

eclipse git repository branch egit

My repository has only one branch HEAD. My local branch is master and I'm usually checked out on my local branch. Now when I pull it won't update my local master. I have to right click on master ->...