Generating the Switch/Select statement for enumeration variables
April 30th, 2012
CodeRush with Refactor! Pro provides a code provider that allows you to easily generate a switch (C#) or Select (VB) statement for all elements of the enumeration of the active identifier of the enumeration type. The Create Case Blocks from Enum code provider shows a part of the resulting code before applying it. It is possible to apply the code provider on a local variable or a parameter:
The resulting case statement contains a set of all elements of the enumeration type with markers on each case statement for easier navigation between cases to write the code inside of them:
Similar Posts:
- Declaring enumeration types and its elements in CodeRush
- Refactoring multi-conditional statements: the switch statement and the “if-else-if” ladder
- Code fixes for code issues for switch (select) statements
- Code Issues for Switch (Select) and Case statements
- Refactoring using statements with CodeRush/Refactor!