1
public class Info
{
    public List<string> Projects { get; set; }
    public List<string> Schools { get; set; }
    public List<string> Locations { get; set; }
    public List<string> Interests { get; set; }
    public List<string> Hobbies { get; set; }
}

To intersect 2 lists, you can just do this: list1.Select(a => a.Projects).Intersect(list2.Select(b => b.Projects));

But what if you want to have maybe an third object with the common strings let's say from the first two objects?

Gerald Hughes
  • 5,771
  • 20
  • 73
  • 131

1 Answers1

2

Simplest solution I can think of is Cascading Intersection:

var result = Projects.Intersect(Schools)
                     .Intersect(Locations)
                     .In‌​tersect(Interests​)
                     .Intersect(Hobbies)
                     .ToList();
Mrinal Kamboj
  • 11,300
  • 5
  • 40
  • 74