【发布时间】:2013-12-04 09:03:22
【问题描述】:
我需要从我的数据库中获取账单列表。 这是我的代码:
public static List<dynamic> GetBillers()
{
DataLayer.DLContext context = new DataLayer.DLContext();
var Billers = (from b in context.Biller
where b.IsActive == true && b.IsDeleted == false
select new
{
ID = b.ID,
DisplayName = b.DisplayName
}).ToList();
return Billers;
}
我收到此错误:
无法将类型
Collections.Generic.List<AnonymousType#1>隐式转换为System.Collections.Generic.List<dynamic>
请帮忙。
【问题讨论】:
-
为什么不直接创建一个 Dto 来存储对象呢?那你就不依赖
dynamic..