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

Renaming duplicate properties using Resharper

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 property you want to keep:

//public bool IsOpen { get; set; }

public bool Open { get; set; }

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

resharper
Posted by: Wallace Turner
Last revised: 19 Sep, 2011 11:33 AM History

Comments

No comments yet. Be the first!

No new comments are allowed on this post.