Refactoring Requested: Move Static Method

I think this has probably been asked before, but why can't you guys make a "Move Static Method/Property" refactoring.

Here's my scenario:
I've got a "Name" static property on a class (ClassA). I recently made a new class (ClassB), and I want everywhere that points to ClassA.Name to point to ClassB.Name instead. I can do FindUsages and go through 1 by 1, but thats a pain because theres 100's of usages.

Can resharper do this now or in the future?

Thanks.

5 comments
Comment actions Permalink

Hello Eric,

Move Static Members refactoring will be implemented in one of the nearest
builds.

Thanks,
Andrey Simanovsky


0
Comment actions Permalink

Hello Eric,

Why not a simple Search & Replace?

I think this has probably been asked before, but why can't you guys
make a "Move Static Method/Property" refactoring.

Here's my scenario:
I've got a "Name" static property on a class (ClassA). I recently made
a new class (ClassB), and I want everywhere that points to ClassA.Name
to point to ClassB.Name instead. I can do FindUsages and go through 1
by 1, but thats a pain because theres 100's of usages.
Can resharper do this now or in the future?

Thanks.



0
Comment actions Permalink

For one thing it doesn't add any using statements.

Sincerely

Jens Peter Grosen

0
Comment actions Permalink

Hello John,

Simple search and replace may not work if you use unqualified calls of ClassA.Name
or aliased access to ClassA. There are several other issues as well.

Thanks,
Andrey Simanovsky


0
Comment actions Permalink

I would do this, but it's simply not as easy as having resharper do it for me. And, due to "management" I now have to do something like this for over 20 classes and its hard to "trust" find and replace when there are more results than you want to read through.

Also, if the static function is called on a subclass of the class your moving it from, then the search-replace wont catch that at all.

0

Please sign in to leave a comment.