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.
Please sign in to leave a comment.
Hello Eric,
Move Static Members refactoring will be implemented in one of the nearest
builds.
Thanks,
Andrey Simanovsky
Hello Eric,
Why not a simple Search & Replace?
For one thing it doesn't add any using statements.
Sincerely
Jens Peter Grosen
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
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.