I'm trying to wrap my head around this in LINQPAD and keep failing. Basically I need the entries that have a corresponding entry ending with "_SCHEMA".
So from the list below, I need "Dumbo" entry only
void Main()开发者_如何学Python
{
var users = new List<User> {new User{Name="Dummy"}, new User{Name="Dumbo"},
new User{Name="Dunno"}, new User{Name="Dumbo_SCHEMA"}};
}
class User
{
public string Name{get;set;}
}
Any thoughts are welcome.
Like this?
from user in users
where users.Any(inner => inner.Name == user.Name + "_SCHEMA")
select user
Edit: Beware of performance issues on too large sets.
精彩评论