How to refactor a bunch of methods to make them static?

75 views Asked by At

We found that a bunch of methods in our code could be made static (since they are functional in nature, and do not alter any data in the class). This means of course that all references to these methods must be changed also.

Is there a refactoring command available to do this quickly and safely?

2

There are 2 answers

0
user2184057 On BEST ANSWER

https://www.jetbrains.com/resharper/webhelp/Refactorings__Make_Method_Static.html

Check #Resharper i think this is what you are looking for but i am not sure about license.

0
Patrick Hofman On

No. Unfortunately Visual Studio hasn't a way to change the signature of the method automatically, besides the name. The best I have come up with in these situations is Find and Replace...

Resharper has a method to do this though.