我的代码应该检查两个条件并返回值,但当我尝试返回 q 时,会出现以下错误:
这是我的代码。
我尝试了一切方法,但仍然没有解决,也不知道如何设置无法隐式转换类型'System.Collections.Generic.List<< anonymous type: string Name, string File>>'到'System.Collections.Generic.List< string>
List<string>
或将其设置为List<EF_Model.PDF>
,PDF是我的模型中的DTO。这是我的代码。
internal List<string> Customers_File(int _id)
{
using (var Context = new EF_Model.CoolerEntities())
{
var q = from c in Context.Customers
where c.Id == _id &&
c.Ref_PDF != null
select new { c.PDF.Name, c.PDF.File };
return q.ToList();
}
}