A neat (or is it obvious) way of renaming 2 duplicate properties to a single property name.

Renaming duplicate properties using Resharper

You are looking at revision 1 of this page, which may be out of date. View the latest version.  

You might come across some code like this

public bool IsOpen { get; set; }

public bool Open { get; set; }

Don't question the why - just accept its evolved and requires cleaning up.

Assume both are used in many places (otherwise you can do a manual refactor easily)

If you use Resharper to Rename (Ctrl-R,R) IsOpen to Open Resharper will only replace the calls in that class and external calls wont be changed (ie it doesnt work)

The trick is to comment out the method you want it changed to:

//public bool IsOpen { get; set; }

public bool Open { get; set; }

Now you can Rename Open and Resharper will do its magic.

Posted by: Wallace Turner
Last revised: 19 Sep, 2011 11:33 AM History
You are looking at revision 1 of this page, which may be out of date. View the latest version.

Comments

No comments yet. Be the first!

No new comments are allowed on this post.