简体   繁体   中英

Resharper 4.5: How can I discard an interface and change all references to the only implementation?

Given:

  • I have an interface.
  • I have only class that implements that interface.

Question:

With Resharper 4.5 - How can I discard that interface and change all references to the only implementation?

There doesn't seem to be a way to do this "automagically" in one step.

What I would do in this situation is the following:

  1. "Safe-Delete" (Ctrl-R,D [VS] or Alt-Del [IDEA]) the interface, leaving the code with compilation errors.
  2. Navigating to the next error using (Alt-Shift-PgDn [VS] or Alt-F12 [IDEA]).
  3. Pressing Alt-Enter and selecting "Change all IYourInterfaceName" and typing the concrete class name.

Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM