4

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?

3 Answers 3

7

It definitely works with R# 4.5.

  1. Right click on your Foo class.
  2. Select Refactor/Use Base Type where Possible..
Sign up to request clarification or add additional context in comments.

4 Comments

That's confusing. Interface as a Base Type huh?
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
@Deviant How come? Interface is a perfectly valid type.
Replaces Interface with its own base class, System.Object... so completely worthless.
1

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.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.