Это может показаться глупым, но все примеры, которые я нашел для использования Except
в linq, используют два списка или массивы только строк или целых чисел и фильтруют их на основе совпадений, например:
var excludes = users.Except(matches);
Я хочу использовать исключение, чтобы мой код был коротким и простым, но не может показаться, что нужно сделать следующее:
class AppMeta
{
public int Id { get; set; }
}
var excludedAppIds = new List<int> {2, 3, 5, 6};
var unfilteredApps = new List<AppMeta>
{
new AppMeta {Id = 1},
new AppMeta {Id = 2},
new AppMeta {Id = 3},
new AppMeta {Id = 4},
new AppMeta {Id = 5}
}
Как получить список AppMeta
назад, который фильтрует на excludedAppIds
?