Visual studio 2010 Switch statement generation by enum

后端 未结 3 1498
失恋的感觉
失恋的感觉 2021-02-18 15:38

Is there any way to get generation of switch statements by enum?

For example if I have big enum and I have method with has parameter enum, then I need to code switch sta

3条回答
  •  情深已故
    2021-02-18 16:04

    Visual Studio does this with a snippet.

    Type switch, press Tab and then enter the name of your enum variable, and press Enter.

    You should get a switch statement with each enum member case'd.

提交回复
热议问题