How can the linq statement here be altered so that it finds the company(s) containing the user with the substring of \"third\"?
At the moment it only works when sear
You should call string.Contains on the user.Name:
user.Name
companies = companies .Where(company => company.Users.Any(user => user.Name.Contains("third"))) .ToList();
See it working online: ideone