Link to home
Start Free TrialLog in
Avatar of countrymeister
countrymeister

asked on

How to do a Linq left outer join

I have the following ling join, where I tired to do a left join

    var result = (from dataRows1 in listP
                                  join dataRows2 in listV.Where(d => d.BusinessDate != null)
                                  on new { ID = dataRows1.ID, BusDate = dataRows1.BusinessDate } equals
                                     new { ID = dataRows2.ID, BusDate = dataRows2.BusinessDate }

                                  select new T
                                                  {
                                                    BookPrice =  dataRows1.BookPrice,,
                                                      RateApplied = dateRows2.Rate
                                                  }.DefaultIfEmpty().ToList();

But it stilldoes a join.

I have 8000 rows in LisP, and 7000 rows in ListV, I would expect that I get back 8000 rows in my result
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial