Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeRush - Build a SELECT CASE framework

in CodeRush, is there a way to auto-fill a SELECT CASE statement with the available enumerations ?

So, given this enum declaration (or one with a lot more enumeration options)

Public Enum eMailTransmissionMethods
    unknown = 0
    IIS
    AutoEmailer
End Enum

I want to build the following framework.

    Select Case method
        Case eMailTransmissionMethods.IIS
        Case eMailTransmissionMethods.AutoEmailer
        Case eMailTransmissionMethods.unknown
    End Select
like image 880
cometbill Avatar asked Dec 21 '22 15:12

cometbill


1 Answers

Simply:

  • Copy the identifier name to the clipboard
  • Type either select or switch (depending on your language of choice VB.Net vs C#)
  • Hit the space bar

CodeRush works out the type of the identifier on the clipboard, and creates a branch for each value that the enumeration can hold.

Another, more complete, version of this answer is detailed here on my blog complete with pics

like image 75
Rory Becker Avatar answered Dec 27 '22 12:12

Rory Becker