filtering a list using LINQ

后端 未结 5 1465
面向向阳花
面向向阳花 2020-12-09 14:38

i have a list of project objects:

IEnumerable projects

a Project class as a property called Tags

5条回答
  •  旧时难觅i
    2020-12-09 15:07

    var filtered = projects;
    foreach (var tag in filteredTags) {
      filtered = filtered.Where(p => p.Tags.Contains(tag))
    }
    

    The nice thing with this approach is that you can refine search results incrementally.

提交回复
热议问题