-
Notifications
You must be signed in to change notification settings - Fork 238
VB -> C#: Avoid creating code blocks for each case when converting Select Case #1244
Open
Description
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; }
Metadata
Metadata
Assignees
Type
Fields
Give feedbackNo fields configured for issues without a type.