CodeConverter icon indicating copy to clipboard operation
CodeConverter copied to clipboard

VB -> C#: missing where and wrong select in linq with group clause

Open KunzeAndreas opened this issue 2 years ago • 2 comments

VB.Net input code

Private Shared Sub LinqWithGroup()
    Dim numbers = New List(Of Integer) From {1, 2, 3, 4, 4}
    Dim duplicates = From x In numbers
                     Group By x Into Group
                     Where Group.Count > 1
    Assert.That(duplicates.Count = 1)
End Sub

Erroneous output

var duplicates = from x in numbers
                 group x by x into Group
                 select x;

Expected output

var duplicates = from x in numbers
                     group x by x 
                     into Group
                     where Group.Count() > 1
                     select Group;

Details

  • Product in use: VS extension
  • Version in use: 9.0.0.0
  • Did you see it working in a previous version, which? no

KunzeAndreas avatar May 12 '22 10:05 KunzeAndreas

Thanks for the report. The area of code for query syntax is terrible, so this may not get fixed for some time I'm afraid

GrahamTheCoder avatar Jun 15 '22 21:06 GrahamTheCoder

I'll have a look at what I can do about this one :)

Noah1989 avatar Jun 16 '22 13:06 Noah1989