views:

70

answers:

3

I have an upgraded 3rd party library and there used to be an object called Foo and now its an interface called IFoo

what is the best way to change all usages and declarations of Foo to IFoo

i tried doing Find / Replace but this also affected FooBar to IFooBar (which i dont want)

thoughts?

A: 

You should be able to right click on a Foo reference and choose "Refactor This" -> Rename and it will change all the references it can find. Never done this with a 3rd party lib, but works elsewhere.

Chad Grant
+1  A: 

It definitely works with R# 4.5.

  1. Right click on your Foo class.
  2. Select Refactor/Use Base Type where Possible..
Vadim
That's confusing. Interface as a Base Type huh?
Chad Grant
You can also use a shortcut -> With cursor on "Foo" then "Ctrl + Shift + R" and then select "Use Base Type where Possible", which is the way I prefer
Sung Meister
@Deviant How come? Interface is a perfectly valid type.
Anton Gogolev
A: 

As stated by others, ReSharper can do what you are asking for.

As an aside, be sure to get, and print out, the ReSharper Keyboard shortcuts. There are two variations: Visual Studio scheme, and the IDEA scheme (most guys I know use the IDEA scheme).

But there are only two keyboard combination you really need to know: Refactor this: Ctrl+alt+R Navigate from here: Ctrl+alt+G or Alt+' (depending on keyboard scheme)

That will get you to a lot of the most valuable ReSharper functionality.

Chris Brandsma