tags:

views:

41

answers:

1

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()
{
 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.

Sunit

+2  A: 

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.

Albin Sunnanbo
That was simple...thanks.
Sunit