Skip to content

VB -> C#: LINQ query syntax conversion is incorrect when Select is followed by Where #1163

@jswolf19

Description

@jswolf19

VB.Net input code

Public Class Test
    Public Sub Test()
        Dim data = From d In {1.2, 2.2, 3.4, 5.6}
                   Select i = CType(Math.Floor(d), Integer)
                   Where i Mod 2 = 1
    End Sub
End Class

Erroneous output

public class TestType {
    public void Test() {
        var data = from d in new[] { 1.2d, 2.2d, 3.4d, 5.6d }
                   let i = (int)Math.Floor(d)
                   where i % 2 == 1
                   select d;
    }
}

Expected output

public class TestType {
    public void Test() {
        var data = from d in new[] { 1.2d, 2.2d, 3.4d, 5.6d }
                   let i = (int)Math.Floor(d)
                   where i % 2 == 1
                   select i;
    }
}

Details

  • Product in use: VS extension
  • Version in use: 9.2.6.0

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