Any way to surround code block with Curly Braces {} in VS2008?

后端 未结 8 2082
-上瘾入骨i
-上瘾入骨i 2020-12-13 12:42

I always find myself needing to enclose a block of code in curly braces { }, but unfortunately that isn\'t included in the C# surround code snippets, which

8条回答
  •  粉色の甜心
    2020-12-13 13:12

    To complete Ray Vega's answer, for those using Resharper, I figured out you can associate a shortcut to Resharper commands.

    Just do the following (I am using VS 2010):

    go to Tools->Options

    In the listbox, extend Environment and click on Keyboard.

    In the field under "Show commands containing:" enter "resharper.resharper_surroundwith"

    In the field under "Press shortcut keys" enter your shortcut (eg: I choose Ctrl+R,Ctrl+S) and click Assign and then Ok.

    That's it. you can select your code, and type that shorcut to view all Resharper SurroundWith commands. Just enter 7 to put braces.

提交回复
热议问题