I've been tasked with making some significant modifications to a legacy codebase that was not written using our current code style conventions. The changes are extensive enough that I'm doing some cleanup and refactoring (there was quite a bit of dead code) before getting started. One of the things that's bugging me is that the fields are following the m_FieldName naming convention whereas we now use _fieldName.
Is there some way with Resharper to automatically rename all fields in the project to follow the new convention? Are there other tools that can readily do this? It's not too difficult to remove the prefixing 'm' with even a simple search/replace, but I haven't found an automated way to change the case of the starting letter.
Press Ctrl+Shift+R or choose ReSharper | Refactor | Refactor This… from the main menu . Alternatively, you can press Ctrl+Shift+A , start typing the command name in the popup, and then choose it there. The Refactor This list appears. Choose an item from the list and click it or press Enter .
Select Edit > Refactor > Rename. Right-click the code and select Rename.
It might be better to just find/replace <m_
by _
using Visual Studio (regular expression search/replace).
The <
stands for "beginning of word".
Edit: There seems to be no way, using Find/Replace, to modify the casing of that first letter after the underscore.
So you would have to do this operation 26 times in a row, like so:
Replace <m_A by _a
Replace <m_B by _b
and then you're all set. Fun, too :-) But it should only take a few minutes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With