Link to home
Start Free TrialLog in
Avatar of jackjohnson44
jackjohnson44

asked on

linq to objects trying to find object based on list of ids

I have

Class Spread
  List<string>ContractIds

I am trying to find all spreads in a list where the spread contains a contractId from another list.  I can't figure it out.

Here is what I have tried:
public List<Spread> GetSpreadByContractIds(List<string> contractIds)
{
//var spreads = (from s in Spreads where contractIds.Contains(s => s.ContractIds) select s).ToList();
List<Spread> results = (from s in Spreads join cts in contractIds on s.ContractIds equals cts select s).ToList();
return results;
 }
ASKER CERTIFIED SOLUTION
Avatar of Gautham Janardhan
Gautham Janardhan

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