'System.Linq.IQueryable<Sitecore.ContentSearch.SearchTypes.SearchResultItem>' 不包含 'Where' 的定义
'System.Linq.IQueryable<Sitecore.ContentSearch.SearchTypes.SearchResultItem>' does not contain a definition for 'Where'
我遇到以下代码的错误:
代码:
using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
{
var results = context.GetQueryable<SearchResultItem>().Where(x => x.TemplateId == templateID).ToList();
}
错误:
'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?)
谁能告诉我这是什么原因?
检查您是否参考了 System.LINQ
我遇到以下代码的错误:
代码:
using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
{
var results = context.GetQueryable<SearchResultItem>().Where(x => x.TemplateId == templateID).ToList();
}
错误:
'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?)
谁能告诉我这是什么原因?
检查您是否参考了 System.LINQ