Cheung
Cheung

Reputation: 15552

Rename the class in safe way?

I have .NET project using VS 2010 Pro, Some of the class name in App_Code is

I think it is not good naming convention,so i would to rename that, however, if i use search (products) and replace to (clsproducts) , it possible replace some text which is not the class,so is it any tool to do that?

Upvotes: 1

Views: 209

Answers (4)

Hamid Nazari
Hamid Nazari

Reputation: 3985

Changing filenames wouldn't be a problem. To rename a class name, just actually rename the class name in its deceleration statement, a red line would appear underneath it, hover your mouse pointer over it and click on Rename or Rename with Preview. It's gonna take care of everything, except if you have used some creepy smelly hard coded reflection techniques then it's gonna become a problem.

Upvotes: 0

Sruly
Sruly

Reputation: 10550

There is a replace with preview option so unless your project is extremely large you can manually go through the list of changes and decide which ones to change.

Upvotes: 0

Hans Olsson
Hans Olsson

Reputation: 55039

If you want to rename a class, just right click on it and select Rename..., that'll make sure that all references to it are renamed as well.

Upvotes: 4

leppie
leppie

Reputation: 117280

Just use the refactoring tools in VS. They work great :)

Upvotes: 2

Related Questions