Suhas
Suhas

Reputation: 417

'System.Linq.IQueryable<Sitecore.ContentSearch.SearchTypes.SearchResultItem>' does not contain a definition for 'Where'

I am getting below error with the following code:

Code:

using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
{
  var results = context.GetQueryable<SearchResultItem>().Where(x => x.TemplateId == templateID).ToList();
}

Error:

'System.Linq.IQueryable' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Linq.IQueryable' could be found (are you missing a using directive or an assembly reference?)

Can anybody let me know the reason for this?

Upvotes: 1

Views: 661

Answers (1)

David Abaev
David Abaev

Reputation: 696

Check if you have references to System.LINQ

Upvotes: 2

Related Questions