Cutting and Pasting Rectangles in Visual Stuido .NET

This is one of many gems in Mihn’s killer book Visual Studio .NET Tips and Tricks.  But today was a prime example of how cool this is.  I had a whole slew of variables that were marked as Private but needed to be marked as protected instead.  Also, I had to change all of the corresponding methods that referenced these guys as well.  So, I did it the easy way.  First, I collapsed all of the functions – this let me work with just the text in the function.  Then, starting with the private variables, I put my cursor at the beginning of the first variable’s scope declaration, held down the Alt button and dragged my mouse down to the bottom of the last variable name and the cut and pasted right over the old names.  Viola, I just changed them all.  Even better was the functions.   If I didn’t collapse them, then I’d run the risk of cutting some of the code inside the functions – although today that probably would have been a good thing.  But since they’re collapsed, I can work with only the portions in the signature, and do the exact same thing.  Sure, it’s not something you’ll do every day – but it’s a real time saver for tasks like this:

One thought on “Cutting and Pasting Rectangles in Visual Stuido .NET

Leave a Reply

Your email address will not be published. Required fields are marked *