Visual Studio Tip: Faster than CTRL+X, CTRL+V

Sign in to queue

Description

Sometimes you need to move a line or block of code. Usually you would cut and paste the code. Well, if you only need to move it up or down a few lines, try selecting the code to move and using the keyboard shortcut Alt+Up arrow or Alt+Down arrow to move the selected code up or down within the code editor.

Embed

Download

The Discussion

  • User profile image
    Victor12

    Woooou that's awesome

  • User profile image
    Javier Junca

    This tips is only for VS2013? I have 2012 and not work :(

  • User profile image
    dude

    Ha ha!

  • User profile image
    Alejandro Chavez

    Magic!!

  • User profile image
    Oscar Campillo

    Excelent!

  • User profile image
    Joshua Glez

    Great tip! I need it for all microsoft technologies, very practical

  • User profile image
    HockeyGeek​Girl

    Glad it's helpful. Do let me know if you have discovered any great tips I should share in future videos!

    As for the VS2012 vs VS2013... I promise not all the tips will be VS2013 only, though this one happens to be a new feature in VS2013.  Even if you work somewhere that only has 2012, you can always explore VS2013 with the express version, or try it on a VM, there is actually a VM in the Azure VM gallery with the CTP of the latest Visual Studio! 

     

  • User profile image
    ciupaz

    In my case, using VS 2013 Ultimate, this shortcut (ALT+arrowKey) does not have any effect. 

  • User profile image
    HockeyGeek​Girl

    That's odd, you do need to have code selected when you do the ALT+up arrow or ALT+down arrow. This feature was added in VS 2013 so you should have it, it works even in the express editions.

  • User profile image
    OzBobWa

    Look at how many comments you've generated for this neat tip.

    Keep them coming, short and sweat.

    I love these little efficiencies.  I'm re-tweeting now.

    Can you do one on minimizing chunks of code?

    @ch9 pls Twit these.

  • User profile image
    Kolli

    Hey that's Great tip. Thanks for sharing.

  • User profile image
    kvrnsatish

    That's a great tip(a)

  • User profile image
    HockeyGeek​Girl

    @OzBobWa:Glad you like the tip... what do you mean by minimizing the chunks of code? Are you talking about things like autoimplemented properties? so you can write less code to do the same thing?

Add Your 2 Cents