I have a list of numbers as shown below:
1) List<long> list1 : 101, 102, 103
And I have a list of Objects, in which one property is long:
2) List<SomeObject> list2:
SomeObject[0]- (long)Id : 101,
Name: Adam,
Address:xxx
SomeObject[1]- (long)Id : 102,
Name: Bran,
Address:xxx
SomeObject[2]- (long)Id : 109,
Name: Queen,
Address:yyy
I want to query the second list if it has Id's present in list1. Meaning I should get list containing :
SomeObject[0]
SomeObject[1]
Tried the code below with no success:
(from t2 in list2
where list1 .Any(t => t2.Id.Contains(t)) == true
select t2);
Thanks in advance.