Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jswolf19 opened this issue Jan 9, 2025 · 0 comments
Labels
VB -> C# Specific to VB -> C# conversion

Comments

@jswolf19
Copy link

jswolf19 commented Jan 9, 2025

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
@jswolf19 jswolf19 added the VB -> C# Specific to VB -> C# conversion label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

1 participant