【发布时间】:2021-04-22 19:22:30
【问题描述】:
我有哈希集 1-7。
这些Hashset响应9个priorityCode;
Hash Set Value 1 表示 1、2 和 3
Hash Set 是过滤器的值,除了 Hash Set 中的第一个值对应三个优先级代码。
如何过滤我的列表?有什么方法可以基本上做一个“如果 hashSet 的值为 1 将其转换为 priorityCode 1-3?
这是它过去的工作方式,但设计更改为表示 1-7,而在数据库/后端中设置的优先级代码值保持不变。
private static IEnumerable<TabularScheduledItemViewModel> FilterByPriority(
ICollection<int> hashSet,
IEnumerable<TabularScheduledItemViewModel> jobList)
{
if (hashSet.Contains(1))
{
}
return priorityFilter.Count == 0
? jobList
: jobList.Where(c => priorityFilter.Any(o => o == c.PriorityCode));
}
【问题讨论】: