Col*_*nor 3 c# list anonymous-types
我有一个存储在b中的匿名类型列表(来自列表),我想在列表中添加一个新对象.当我尝试将新的匿名对象添加到此列表时,我收到此错误:
'System.Collections.Generic.List.Add(AnonymousType#1)'的最佳重载方法匹配具有一些无效参数.我也得到这个错误:参数1:无法从'AnonymousType#2'转换为'AnonymousType#1'
var b = user.Orders.Select(i => new { id = i.BillingId , text = i.Billing.ToString() }).ToList();
b.Add(new { id = 0 , text = "New Billing Address" });
Run Code Online (Sandbox Code Playgroud)
提前致谢