Skip to content

VB -> C#: "Group By Into" Linq queries supressing aggregations ("Into" part) in the converted code #1272

Description

@jhudler

VB.Net input code

   Public Class Entity
      Public Property Property1 As String
      Public Property Property2 As String
      Public Property Value As Decimal    
   End Class
   
   Dim entityCollection As IEnumerable(Of Entity)
   Dim queryMax = From item In entityCollection
                       Where item.Property1 = "dummy"
                       Group By item.Property1, item.Property2
                       Into ValueMax = Max(item.Value)
                       Select New With {
                           Property1, Property2, ValueMax
                       }

Erroneous output

   var queryMax = from item in entityCollection
                  where item.Property1 == "dummy"
                  group item by new { item.Property1, item.Property2 } into Group
                  select new { Property1, Property2, ValueMax };

Expected output

   var queryMax = from item in entityCollection
                  where item.Property1 == "dummy"
                  group item by new { item.Property1, item.Property2 } into Group
                  select new { Property1 = Group.Key.Property1, Property2 = Group.Key.Property2, ValueMax = Group.Max(i => i.Value) };

Details

  • Product in use: codeconv.exe (dotnet tool)
  • Version in use: 10.0.1.92
  • Did you see it working in a previous version, which? No

Metadata

Metadata

Assignees

No one assigned

    Labels

    VB -> C#Specific to VB -> C# conversion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions