我有以下课程:
public class DistributionItem
{
public int DeviceID { get; set; }
public string DeviceName { get; set; }
public double? Export { get; set; }
public double? Import { get; set; }
public List<double?> Tarrifs { get; set; }
public bool HasChild { get; set; }
public int OrderNum { get; set; }
public double PF { get; set; }
public int? MaxDmd { get; set; }
public string ImageUrl { get; set; }
public int ParentID { get; set; }
public double? Total { get; set; }
}
我想在Select
这个类的 List 上创建一个 LINQ 来提取一些这样的属性:
return data.Select(x => new
{
x.DeviceID,
x.DeviceName,
x.HasChild,
x.KwhImport,
x.KwhExport,
x.MaxDmd,
x.ParentID
}).ToList();
如何将Tarrifs
值作为单独的属性添加到匿名对象?