简体   繁体   中英

Rename the class in safe way?

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

  • products (products.cs)
  • commons (commons.cs)
  • members (members.cs)

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?

如果要重命名一个类,只需右键单击它并选择Rename ... ,这将确保所有对该类的引用也被重命名。

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

有一个替换为预览选项,因此,除非您的项目非常大,否则您可以手动查看更改列表并决定要更改的内容。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM