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#: Use string.IsNullOrEmpty when comparing string to string.Empty #874

Closed
Yozer opened this issue Apr 12, 2022 · 0 comments · Fixed by #875
Closed

VB -> C#: Use string.IsNullOrEmpty when comparing string to string.Empty #874

Yozer opened this issue Apr 12, 2022 · 0 comments · Fixed by #875
Assignees
Labels
enhancement VB -> C# Specific to VB -> C# conversion

Comments

@Yozer
Copy link
Member

Yozer commented Apr 12, 2022

VB.Net input code

Sub TestMethod(a as String)
    Dim result = a = ""
    result = a = String.Empty
End Sub

Erroneous output

public void TestMethod(string a)
{
    bool result = string.IsNullOrEmpty(a);
    result = (a ?? "") == (string.Empty ?? "");
}

Expected output

public void TestMethod(string a)
{
    bool result = string.IsNullOrEmpty(a);
    result = string.IsNullOrEmpty(a);
}

Details

  • Product in use: e.g. codeconverter.icsharpcode.net / VS extension / both
  • Version in use: e.g. 5.6.3 or a commit hash (if it's a 3rd party tool using this library, try one of the above)
  • Did you see it working in a previous version, which?
  • Any other relevant information to the issue, or your interest in contributing a fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant