C# 如何使用Linq将信息从集合中选择到我创建的另一个具体类中?

C# 如何使用Linq将信息从集合中选择到我创建的另一个具体类中?,c#,linq,class,sum,datarow,C#,Linq,Class,Sum,Datarow,我有以下课程: public class EntityJESummary { public int JEGroupingId { get; set; } public int PartnershipId { get; set; } public int JEId { get; set; } public DateTime BookingDate { get; set; } public DateTime EffectiveDate { get; set;

我有以下课程:

public class EntityJESummary
{
    public int JEGroupingId { get; set; }
    public int PartnershipId { get; set; }
    public int JEId { get; set; }
    public DateTime BookingDate { get; set; }
    public DateTime EffectiveDate { get; set; }
    public bool Allocated { get; set; }
    public int JEEstate { get; set; }
    public float Debit { get; set; }
    public float Credit { get; set; }
    public string JEComments { get; set; }

    public EntityJESummary()
    {

    }
}
在这里,我使用Linq从源中过滤出数据行。我正在尝试将此数据源中的信息放入这个新的holder类型类中

有什么建议吗

_dttMasterViewTransaction = dtsTransaction.Tables["tblTransaction"];

var datos = _dttMasterViewTransaction.AsEnumerable()
         .Where(r => r["JEID"] == FundsID)
         .Select(new EntityJESummary ???
注意,在我使用r[“foo”]的地方,我从每个数据行获取数据。我需要获得特定的行,并将它们放入holder类的特定属性中

此外,在数据表中,单个JEId可能有许多行,因此我想从每个数据行中获取每个借方,并将其相加到float Debit属性中


如有任何建议,将不胜感激。:)

未经测试,但尝试与Where子句类似的操作:

var datos = _dttMasterViewTransaction.AsEnumerable()
.Where(r => r["JEID"] == FundsID)
.Select(r => new EntityJESummary { 
      JEGroupingId = r["JEGroupingId"],
      PartnershipId = r["PartnershipId"],
      .....
    } );
你可以利用

_dttMasterViewTransaction = dtsTransaction.Tables["tblTransaction"];

var datos = _dttMasterViewTransaction.AsEnumerable()
    .Where(r => r["JEID"] == FundsID).Select(r =>
        new EntityJESummary() {
            JEGroupingId = r["JEID"],
            PartnershipId = r["PartnershipId"]
        };