Link to home
Start Free TrialLog in
Avatar of countrymeister
countrymeister

asked on

Finding a match in List<T>

I have a object O which has four properties a, b, c and d, I have a list List<T>.
I need to find the match in List<T> which matches the values of a and b in Object O

The object O could have a match in List<T>, but not always.
Trying to do this in linq, or whichever is most effective from a performance point.
List<T> could have around 1000 records.
SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland 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
ASKER CERTIFIED SOLUTION
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
I'm a touch surprised at the choice you made.
The comment by minhvc is effectively a copy of my comment but differing in one important aspect.  That only returns one item at most, as you wanted to select on a subset of the properties I thought the FindAll would be rather more suitable which returns more than one item if there were multiple matches in the list.  Of course for just one match or none the return results of both methods would be the same.