CodeConverter
CodeConverter copied to clipboard
VB -> C#: missing where and wrong select in linq with group clause
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
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
I'll have a look at what I can do about this one :)