Extract [class|interface] to seperate file

Something I do occasionally if I'm trying to do something rapidly is put all the classes in one file. Extracting them into a seperate file while maintaining the namespace and any used using (pardon the pun) statements would be (IMO) quite a useful refactor.

Or is this already implemented and I've not seen it?

Thoughts?

8 comments
Comment actions Permalink

Hello John,

Try Move Type refactoring, it has an option to put it into separate file.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


JM> Something I do occasionally if I'm trying to do something rapidly is
JM> put all the classes in one file. Extracting them into a seperate
JM> file while maintaining the namespace and any used using (pardon the
JM> pun) statements would be (IMO) quite a useful refactor.
JM>
JM> Or is this already implemented and I've not seen it?
JM>
JM> Thoughts?
JM>


0
Comment actions Permalink

Hello John,

You can move class to a separate file via Move refactoring (ReSharper->Refactor->Move).
Run it on a class and select the "another file" option instead of the default
"another namespace" one.

Something I do occasionally if I'm trying to do something rapidly is
put all the classes in one file. Extracting them into a seperate file
while maintaining the namespace and any used using (pardon the pun)
statements would be (IMO) quite a useful refactor.

Or is this already implemented and I've not seen it?

Thoughts?

Best regards,
Andrey Simanovsky


0
Comment actions Permalink

sigh I knew I'd missed it :) So much functionality :)

Thanks guys.

0
Comment actions Permalink

Andrey Simanovsky (JetBrains) wrote:

Hello John,

You can move class to a separate file via Move refactoring
(ReSharper->Refactor->Move). Run it on a class and select the
"another file" option instead of the default "another namespace" one.

Something I do occasionally if I'm trying to do something rapidly is
put all the classes in one file. Extracting them into a seperate
file while maintaining the namespace and any used using (pardon the
pun) statements would be (IMO) quite a useful refactor.

Or is this already implemented and I've not seen it?

Thoughts?

Best regards,
Andrey Simanovsky


Can be there a function that i have more classes in one file, run some
"move multiple" and this function moves all(selectable) classes within
one file to another namespaces/files ?
It can be usefull for me, and maybe for others...

--
Peter Sulek
Slovakia
terrorix@centrum.sk

0
Comment actions Permalink

Hello Peto,

This functionality is partly incorporated into Move. If you try to move any
one of the types to another namespace you are asked if you wish to move the
others as well.

Andrey Simanovsky (JetBrains) wrote:

>> Hello John,
>>
>> You can move class to a separate file via Move refactoring
>> (ReSharper->Refactor->Move). Run it on a class and select the
>> "another file" option instead of the default "another namespace" one.
>>
>>> Something I do occasionally if I'm trying to do something rapidly is
>>> put all the classes in one file. Extracting them into a seperate
>>> file while maintaining the namespace and any used using (pardon the
>>> pun) statements would be (IMO) quite a useful refactor.
>>>
>>> Or is this already implemented and I've not seen it?
>>>
>>> Thoughts?
>>>
>> Best regards,
>> Andrey Simanovsky

Can be there a function that i have more classes in one file, run some
"move multiple" and this function moves all(selectable) classes within
one file to another namespaces/files ?
It can be usefull for me, and maybe for others...

Best regards,
Andrey Simanovsky


0
Comment actions Permalink

Hello Peto,


Sorry, I meant,
Hello Peter,

This functionality is partly incorporated into Move. If you try to
move any one of the types to another namespace you are asked if you
wish to move the others as well.

Best regards,
Andrey Simanovsky


0
Comment actions Permalink

Andrey, I agree with Peter that if I am moving a type from a file with multiple
types and am electing to move them to a new file, then allowing me to move
'neighbour types' (as you call them in the 'move to different namespace'
refactoring) would be an excellent option. Even if the option only allowed
me to do a bulk move to files with the same name as the types I would like
it, but presenting me with a list of the types, along with the filenames
and allowing me to change the filenames for each type would lovely :)


0
Comment actions Permalink

Sean Kearon wrote:

Andrey, I agree with Peter that if I am moving a type from a file
with multiple types and am electing to move them to a new file, then
allowing me to move 'neighbour types' (as you call them in the 'move
to different namespace' refactoring) would be an excellent option.
Even if the option only allowed me to do a bulk move to files with
the same name as the types I would like it, but presenting me with a
list of the types, along with the filenames and allowing me to change
the filenames for each type would lovely :)


+1 for that :)

--
Peter Sulek
terrorix@centrum.sk

0

Please sign in to leave a comment.