The purpose is to join these two lists, and if in the pr
list you have an item that does not match the un
list, the default value is returned.
I know there are other ways, however, I'd like a solution using DefaultIfEmpty
var pr = new List<int>() { 1, 2, 3 };
var un = new List<int>() { 1, 2 };
var pu = from p in pr.DefaultIfEmpty(new int())
join u in un on p equals u
select p;
foreach (var i in pu)
{
Console.WriteLine(i);
}
Result: 1.2 Expected: 1,2,0