K
Kowalski
I want to move a class from one namespace to another.
Do you know any refactoring tool with such a feature?
Do you know any refactoring tool with such a feature?
Peter Bromberg said:Am i missing some important concept here? All you need to do is retype a new
namespace over the existing namespace declaration at the top of the class...
On re-reading this, I'm guessing that this revolves around a potential
misunderstanding between namespaces and assemblies.
Namespace is just a logical way of grouping related classes together. They
don't even need to be in the same physical compiled assembly.
I'm guessing that you are looking for something to move a class into a
separate physical assembly (not namespace)?
And anything that uses it needs to make sure they use the new namespace
too.
Oh, and to keep things consistent you'll want to move the file too.
Optionally.
It's handy to get a tool to do these things for youMy guess is that
ReSharper is likely to be capable of this, but I haven't checked.
Kowalski said:I want to move a class from one namespace to another.
Do you know any refactoring tool with such a feature?
arise like namespace conflicts if the same class name is used in multiple
namespaces. The refactoring tool would need to know to handle changing
"using" statements, or to update references to fully qualified names and
remove using statements etc. Would be interested to know if any of the
refactoring tools handle this.
I would go one of two routes. 1) Change the namespace and then lean on the
compiler. 2) Replace all references with fully qualified names. Then do a
search and replace.
Kowalski said:I was doing almost the same thing with search and replace, sometimes
renaming namespace was helpful (VS has that).
Jon suggested "ReSharper" and it works
The "Move Type" function does the job.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.