EF data GroupBY multi-field query VB.NET and C # reference

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#version comparison

{

var g = lst.Data.GroupBy(T => new< /span>
{
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)
});
}

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 )
})

{

var g = lst.Data.GroupBy(T => new< /span>
{
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)
});
}

Leave a Comment

Your email address will not be published.