public class ConsumableThreshold
{
public int ThresholdType { get; set; }
public int ManufacturerID { get; set; }
public int ModelID { get; set; }
public int ConsumableVariantID { get; set; }
}
공유 속성에 대한 개체 목록 두 개를 확인하려고합니다. 이전 경기의 결과에 따라 여러 가지 다른 속성을 확인해야합니다.여러 조건에서 목록 비교
예를 들어 ThresholdType이 일치하면 두 번째 속성을 확인해야하며 일치하는 경우 ModelID를 확인해야합니다.
나는이 쿼리를 사용하여 효과적으로 원하는 것을 수행하지만, 더 많은 것을 드릴 다운하면 가독성이 감소 될 것이므로 주로 문제가 있습니다.
var query= existingThresholds.Where(
e => defaultThresholds.Any(
d => d.ThresholdType == e.ThresholdType)).Where(
e => defaultThresholds.Any(
d => d.ManufacturerID == e.ManufacturerID)).ToList();
나는
join
를 사용하여이 작업을 수행하고 싶어하지만
&&
연산자를 지원하지 않습니다.
.Where()
조건을 연결하지 않고 쿼리로 작성하는 방법이 있습니까?