[英]Find item from the list
equipment
has three items, and carspecification
is a list item. equipment
有三个项目, carspecification
是一个清单项目。 In the carspecification
, there is an equipmentId
property. 在carspecification
,有一个equipmentId
属性。
How could I able to find equipment item(s) to find only equipment matches with equipmentId
in carspecification
. 我如何能够找到设备项目,以仅查找与carspecification
equipmentId匹配的equipmentId
。
var equipment = _carService.GetCarEquipment(carId);
var carSpecification = _carSpecificationService.GetId(specificationId);
I have tried the following, but it does not work. 我已经尝试了以下方法,但是它不起作用。
var eq = equipment.Select(x => x.Id.Equals(carSpecification.Select(y=> y.EquipmentId)));
您可以使用任何:
var result = equipment.Where(e => carSpecification.Any(s => s.specificationId == e.Id));
equipment.Where(e => carSpecification.Select(c => c.EquipmentId).Contains(e.Id))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.