LINQ query in function that takes param to change resultset

/ Published in: C#
Save to your folder(s)

Copy this code and paste it in your HTML
  1. IQueryable<Person> GetManagersWithName (IQueryable<Person> people, string name)
  2. {
  3. return from p in people
  4. where p.Name == name && // implicit closure over 'name'
  5. p.PersonType == PersonType.Manager
  6. select p;
  7. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.