c# linq right join code example
Example 1: c# left join linq
var query = from person in people
join pet in pets on person equals pet.Owner into gj
from subpet in gj.DefaultIfEmpty()
select new { person.FirstName, PetName = subpet?.Name ?? String.Empty };
Example 2: join in linq c#
IList<string> strList1 = new List<string>() {
"One",
"Two",
"Three",
"Four"
};
IList<string> strList2 = new List<string>() {
"One",
"Two",
"Five",
"Six"
};
var innerJoin = strList1.Join(strList2,
str1 => str1,
str2 => str2,
(str1, str2) => str1);