When converting a Select Case statement, each outcome is wrapped in braces, creating a code block. This adds unnecessary indentation.
For example:
Private Shared Function d1mach(i As Integer) As Double
Select Case i
Case 1
Return 2.2250738585072014E-308 ' the smallest positive magnitude.
Case 2
Return Double.MaxValu ' the largest magnitude.
End Select
Return 0
End Function
Is converted as:
private static double d1mach(int i)
{
switch (i)
{
case 1:
{
return 2.2250738585072014E-308d; // the smallest positive magnitude.
}
case 2:
{
return double.MaxValue; // the largest magnitude.
}
}
return 0d;
}
Proposed solution
When no variable is created in the case branch, avoid creating a code block. The output code would be:
private static double d1mach(int i)
{
switch (i)
{
case 1:
return 2.2250738585072014E-308d; // the smallest positive magnitude.
case 2:
return double.MaxValue; // the largest magnitude.
}
return 0d;
}
When converting a
Select Casestatement, each outcome is wrapped in braces, creating a code block. This adds unnecessary indentation.For example:
Is converted as:
Proposed solution
When no variable is created in the case branch, avoid creating a code block. The output code would be: