我正在尝试执行以下操作:
class Account
{
public virtual Ilist<Manager> Managers{get;set;}
}
class Manager
{
public virtual Ilist<Account> Accounts{get;set;}
}
...
private void Filter()
{
// List of Accounts
// Each Account has one or more Managers
// Each Manager has one or more Accounts
Ilist<Manager> FilteredManagers = new List<Manager>();
FilteredManagers .Add(new Manager(1));
FilteredManagers .Add(new Manager(2));
etc.
//I tried something like
var _Accounts = from a in Accounts
where FilteredManagers.Contains(a.Managers)
select a
//but this didn't compile
}
我想对 Accounts 运行一个查询,该查询返回所有具有一个或多个 Managers 的 Accounts,这些 Managers 也在 FilteredManagers 中我想这是一种相当愚蠢的方法,但我对编程很陌生。