Here I have a list of string in sites1. I need to check the common items between sites1 and items1 and select the matching items from items1. Here is my code
string query = "/sitecore/content/*";
List<string> sites1 = Sitecore.Configuration.Settings.Sites.Select(x => x.StartItem.TrimStart('/')).ToList();
List<Item> items1 = Sitecore.Context.Database.SelectItems(query).Where(x => x.DisplayName.Contains(sites1)).ToList();
Any suggestion?
Edit: Here i am getting the error while selecting two items
var sites = Sitecore.Configuration.Settings.Sites.Select(f => new List<string>() { f.StartItem.TrimStart('/'), f.Language }).ToList();
List<Item> items = Sitecore.Context.Database.SelectItems(query).Where(x => sites.Contains(x.DisplayName.ToLower())).ToList();
sites1.Contains(x.DisplayName)removex.