leora
leora

Reputation: 196891

Resharper change object to interface

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?

Upvotes: 4

Views: 429

Answers (3)

Chris Brandsma
Chris Brandsma

Reputation: 11736

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.

Upvotes: 1

Vadim
Vadim

Reputation: 21724

It definitely works with R# 4.5.

  1. Right click on your Foo class.
  2. Select Refactor/Use Base Type where Possible..

Upvotes: 7

Chad Grant
Chad Grant

Reputation: 45422

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.

Upvotes: 0

Related Questions