Dim g = lst.Data.GroupBy(Function(T) New With { Key T.mName, Key T.mUnit, Key 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.mUnit, T.mPrice }).Select(t => new { mName = t.Key.mName, mPrice = t.Key.mPrice, mUnit = t.Key.mUnit, mValue = t.Sum(i => i.mValue) }); }