I know that I should not have id with the same value. It is simply fictitious, so ignore it.
I have:
List<Car> carList = new List<Car>();
carList.Add(new Car() { id = 1, name = "Honda" });
carList.Add(new Car() { id = 2, name = "Toyota" });
carList.Add(new Car() { id = 1, name = "Nissan" });
I want to use the Lambda expression to retrieve all cars with id 1.
Expected Result:
- Id: 1, Name: Honda
- Id: 1, Name: Nissan
The problem is more filtering the list of objects based on the foreign key.
source
share