New Bee

New Bee

  • 1.8k
  • 15
  • 228

How do I combine 2 lists into one in linq?

Jul 19 2019 11:56 AM
Hi there, was just wondering how I would able to combine 2 lists together so columns in list one are combined with columns in list 2. In the example below both list have ClientID and FiscalYear.
  1. Lists 1:  
  2. ClientID  |  FiscalYear  | TotalCars  
  3. 1               19-20          100  
  4. 1               20-21          230  
  5. 2               19-20          50  
  6.   
  7. List 2:  
  8. Client ID  |  FiscalYear | NumOfShops  
  9. 1               19-20          5  
  10. 1               20-21          6  
  11. 2               19-20          4  
  12.   
  13. Is there a way to combine both of those list into 1 so that the data is like:  
  14.   
  15. ClientID  |  FiscalYear |  TotalCars | NumOfShops  
  16. 1               19-20         100         5  
  17. 1               20-21         230         6  
  18. 2               19-20         50          4  
Thanks!

Answers (1)