Click here to Skip to main content
15,868,065 members
Articles / Programming Languages / C#
Technical Blog

Alt + Click + Drag shortcut key

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
14 May 2013CPOL 7.8K   2  
It stops you from having to do multiple copy and pastes.

A couple of days ago I found a shortcut key that I don’t think is very well known that is a simple but useful shortcut key. It stops you from having to do multiple copy and pastes.

Say you have code like below,
Now if this were a static class and you had to change all the properties to static you could type once then copy and paste or type multiple times, or you could place you cursor after the public in the first line and the hold Alt + Click and drag down. Yuo should see a slight line (about a pixel or 2) like below.

public string Value1 { getset; }
public string Value2 { getset; }
public string Value3 { getset; }
public string Value4 { getset; }

AltClickDragDown

Now all you do is press space and type static and it should look like below.
This is also very useful for renaming lots of similar variables (if there is the situation).Like I said nothing special but saving time is saving time =D.

public static string Value1 { getset; }
public static string Value2 { getset; }
public static string Value3 { getset; }
public static string Value4 { getset; }

public static string ActualValue1 { getset; }
public static string ActualValue2 { getset; }
public static string ActualValue3 { getset; }
public static string ActualValue4 { getset; }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect SSW
South Africa South Africa

Comments and Discussions

 
-- There are no messages in this forum --