小编aia*_*Lee的帖子

如何使用List <dynamic>

我需要从我的数据库中获取billers列表.这是我的代码:

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;
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

无法隐式转换Collections.Generic.List<AnonymousType#1>System.Collections.Generic.List<dynamic>

请帮忙.

c# list dynamic

3
推荐指数
1
解决办法
133
查看次数

标签 统计

c# ×1

dynamic ×1

list ×1