Does anyone know of a tool or VS add-in that will allow me to take a base class and a derived class, and collapse them into a single 'flattened' class? Or is this too difficult an operation, given the need to cope with resolving overriden and hidden/new members?
Background: I am working on a project where we have a base class and a single derived class that was going to be the first of a few others.
Subsequent analysis work means that the other class will now not be necessary and the specialisation is just proving confusing for coders coming new to the codebase. I'd like to merge the base and the derived class to simplify things (and simplify the database mapping in nHibernate), but both are quite large - so I thought it would be worth checking if a tool could do the job.
As often, ReSharper can help you. There is an option (under menu: Refactor) called "pull members up" where you can select members to be moved to the base class.
There is an option "push members down for the other direction, too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With