Skip to content
New issue

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

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

Already on GitHub? # to your account

VB -> C#: string comparison operators like > and < don't get converted to String.Compare or similar #608

Closed
jamesmanning opened this issue Aug 14, 2020 · 0 comments
Labels
VB -> C# Specific to VB -> C# conversion

Comments

@jamesmanning
Copy link

Input code

    Sub DummyMethod(target As String)
        If target > "" Then
            Console.WriteLine("is greater")
        End If
    End Sub

Erroneous output

        public void DummyMethod(string target)
        {
            if (target > "")
            {
                Console.WriteLine("is greater");
            }
        }

Expected output

probably String.Compare, potentially with an explicit StringComparison value, not sure

        public void DummyMethod(string target)
        {
            if (String.Compare(target, "") > 0)
            {
                Console.WriteLine("is greater");
            }
        }

Details

  • VS extension 8.1.6.0
@jamesmanning jamesmanning added the VB -> C# Specific to VB -> C# conversion label Aug 14, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

1 participant