CodeConverter
CodeConverter copied to clipboard
VB -> C#: improve int const adjustments in some cases
Is your feature request related to a problem? Please describe. I'm always frustrated when a hexadecimal constant is converted in a way I can't search for it anymore (in some cases).
VB.NET input:
Dim i As Integer = &H80040E19
If (i = &H80040E19) Then
End If
Current output:
int i = int.MinValue + 0x00040E19;
if (i == int.MinValue + 0x00040E19)
{
}
Describe the solution you'd like
I think a much nicer output would be using unchecked
instead of changing the constant literal, something like this:
int i = unchecked((int)0x80040E19);
if (i == unchecked((int)0x80040E19))
{
}
Describe alternatives you've considered Write a Roslyn replacement rule to restore the constants in a pass after CodeConverter is done.
Additional context None.