【发布时间】:2013-10-09 19:17:59
【问题描述】:
我正在为依赖注入创建一个测试存储库,下面有我的测试方法。
private List<object> records;
public IList<T> GetFiltered<T>(Expression<Func<T, bool>> action = null) where T : class
{
return ((List<T>)records).Where(action).ToList();
}
我本质上想返回一个过滤的记录列表,其中“操作”条件为真。
我收到以下错误
错误 2 实例参数:无法从 'System.Collections.Generic.List' 转换为 'System.Linq.IQueryable'
请帮忙。
【问题讨论】:
-
我收到
Cannot convert type 'System.Collections.Generic.List<object>' to 'System.Collections.Generic.List<T>'
标签: c# asp.net-mvc linq