简体   繁体   中英

Visual Studio equivalent to Eclipse keyboard shortcut Alt Shift L

I just did a few years of Java and I'm now back in the C# world. I'm actually happy to be back in Visual Studio except for one thing.

The Eclipse shortcut: ALT SHIFT L really grew on me and I can't find an equivalent in Visual Studio to extract local when the cursor is on a method.

Anyone knows the equivalent in Visual Studio please?

There's no native Visual Studio 2010 refactoring command for 'extract local', as Eclipse has.

The closest you'd get is the 'Extract Constant', which isn't by default bound to a keyboard shortcut. To do this, you have to highlight the entire string, including the double-quote " delimiters.

提取常数

You could explore third party IDE addons like CodeRush or ReSharper for more functionality.

For MSVS 2013 you can download Productivity Power Tools 2013 to get Extract Constant - features also Ctrl + Click to Peek Definition (customizable to Go to definition as in all other IDEs I used) and it is free !

To install go to Tools > Extensions and Updates... then Online

TO get 'Extract Constant' you need to install 'PowerCommands for Visual Studio 2010' from:

http://visualstudiogallery.msdn.microsoft.com/e5f41ad9-4edc-4912-bca3-91147db95b99/

With extension VAssisX, you can bind keys to this: VAssisX.RefactorIntroduceVariable

And I think this does what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM