HelloWorld1
HelloWorld1

Reputation: 14108

Change the variable's name only one time

If you have written a sourcecode with 10 000 row in C# and you need to change the variable's name candy into candies and the word candy is located in different position in the same class. I wanna to change the name of the variable being located in different places only one time.

Is there a plugin or tool for Visual studio or a functionality in VS2010?

Upvotes: 1

Views: 11116

Answers (7)

TehBoyan
TehBoyan

Reputation: 6890

Hit Control + Shift + H set what you want to change and select Replace All.

Also you can right click over a variable and choose Refactor -> Rename

Upvotes: 4

user973511
user973511

Reputation: 329

1. Change your variable name

2. Click on the red rectangle

3. Click on the picture

4. Click on rename "MyVariable" in "MyVariable1"

enter image description here

Upvotes: 4

Matthias
Matthias

Reputation: 16199

If you understand you correctly, you simply need to right-click the variable: Refactor -> Rename....

Upvotes: 5

Dmitry Polyanitsa
Dmitry Polyanitsa

Reputation: 1093

You could use CodeRush Xpress, a free tool by DevExpress that allows easy variable\class\method renaming and has lots of other features. Grab it here: http://devexpress.com/Products/Visual_Studio_Add-in/CodeRushX/

Upvotes: 0

Vicky
Vicky

Reputation: 13244

Edit->Replace and tick the "match whole word only" box?

Upvotes: 0

Wael Dalloul
Wael Dalloul

Reputation: 22984

You can right click on the variable and choose Refactor->Rename from the menu, it's the most save way to accomplish it.

for vb.net it's Rename directly...

Upvotes: 1

Tomislav Markovski
Tomislav Markovski

Reputation: 12346

Yes, there is built-in functionality. Change the name of the variable in its declaration line and a popup button will appear right next to it. Click it and choose Rename 'candy' to 'candies'. This will perform full rename wherever the variable is used.

Upvotes: 1

Related Questions