Question: generation of switch statement when passing an enum type to an operation

Like in the following example; is it possible in the current version of ReSharper to have the switch statement automatically generated when passing an enum type to an operation?

1: public ICryptoTransformCommand CreateCryptoTransformCommand(CryptoTransform cryptoTransform) 2: 12: }
Cheers

--
Gabriel Lozano-Morán
The .NET Aficionado
http://www.pointerx.net

3 comments
Comment actions Permalink

Just type alt-enter after: switch(yourEnumVar) {
The lightbulb gives you the choice to generate the cases.
"Gabriel Lozano-Morán" <jb-newsgroups@pointerx.net> schreef in bericht news:e6drbl$g1v$1@is.intellij.net...
Like in the following example; is it possible in the current version of ReSharper to have the switch statement automatically generated when passing an enum type to an operation?

1: public ICryptoTransformCommand CreateCryptoTransformCommand(CryptoTransform cryptoTransform) 2: { 3: switch (cryptoTransform) 4: { 5: case CryptoTransform.Encrypt: 6: break; 7: case CryptoTransform.Decrypt: 8: break; 9: default: 10: throw new NotImplementedException(); 11: } 12: }
Cheers

--
Gabriel Lozano-Morán
The .NET Aficionado
http://www.pointerx.net

0
Comment actions Permalink

ReSharper rocks!!

--
Gabriel Lozano-Morán
The .NET Aficionado
http://www.pointerx.net
"Guy Mahieu" <guy.mahieu@nospam.be> wrote in message news:e6druj$ija$1@is.intellij.net...
Just type alt-enter after: switch(yourEnumVar) {
The lightbulb gives you the choice to generate the cases.
"Gabriel Lozano-Morán" <jb-newsgroups@pointerx.net> schreef in bericht news:e6drbl$g1v$1@is.intellij.net...
Like in the following example; is it possible in the current version of ReSharper to have the switch statement automatically generated when passing an enum type to an operation?

1: public ICryptoTransformCommand CreateCryptoTransformCommand(CryptoTransform cryptoTransform) 2: { 3: switch (cryptoTransform) 4: { 5: case CryptoTransform.Encrypt: 6: break; 7: case CryptoTransform.Decrypt: 8: break; 9: default: 10: throw new NotImplementedException(); 11: } 12: }
Cheers

--
Gabriel Lozano-Morán
The .NET Aficionado
http://www.pointerx.net

0
Comment actions Permalink

Hi Gabriel_Lozano-Morán,

Thanks -- I made a note to that effect in our .NET Tools blog :)
I hope you don't mind how I used your cryptoTransform example.

Mikhail Kropotov

ReSharper rocks!!

1: public ICryptoTransformCommand
CreateCryptoTransformCommand(CryptoTransform cryptoTransform) 2:
12: }
Cheers
--
Gabriel Lozano-Morán
The .NET Aficionado
http://www.pointerx.net



0

Please sign in to leave a comment.