我有一个 Fee 类型的列表,我需要从中排除 ID 存在于另一个 int 类型列表中的列表。
List<int> ExcludedFeeIDs = new List<int>{1,2,3,4};
List<Fee> MyFees = (from c in ctx.Fees
select c).ToList();
例子: List GoodFees = (from f in ctx.Fees where f.FeeID!=ExcludedFeeIDs中的ID之一);
请帮忙?
最佳答案
试试这个:
var MyFees = from c in ctx.Fees
where !ExcludedFeeIDs.Contains(c.FeeID)
select c;
关于c# - 当不同类型的列表的属性值相等时,从列表中排除的 Linq 查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1445845/