Ef数据GroupBy多字段查询Vb.net与c#参考

前端之家收集整理的这篇文章主要介绍了Ef数据GroupBy多字段查询Vb.net与c#参考前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Dim g = lst.Data.GroupBy(Function(T) New With
                                     {
                                         T.mName,T.mUnit,T.mPrice
                                     }).Select(Function(t) New With
                                        {
                                        .mName = t.Key.mName,.mPrice = t.Key.mPrice,.mUnit = t.Key.mUnit,.mValue = t.Sum(Function(i) i.mValue)
                                        })

 

c#版本对照

{
    var g = lst.Data.GroupBy(T => new
    {
        T.mName,T.mPrice
    }).Select(t => new
    {
        mName = t.Key.mName,mPrice = t.Key.mPrice,mUnit = t.Key.mUnit,mValue = t.Sum(i => i.mValue)
    });
}

猜你在找的VB相关文章