Can ReSharper bulk refactor "m_" prefixed fields?

Hi All,

A project I've inherited has fairly inconsistent field naming conventions.

Resharper's code analysis is highlighting a lot of fields which are named with "m_" prefix - e.g. "m_bitmap".

I would dearly like to refactor all of these into camel-case with a leading _. Can resharper do this for me en masse, in the whole solution?

It's quite tedious to do it even semi-automatically because resharpers suggestion for the new field name is not what I want - in the "m_bitmap" example above, it suggests "_mBitmap" as a name, which is worse that what I have now.



Comment actions Permalink

Hello Jon,

Currently, Resharper doesn't have any kind of batch action for this, like 'Fix it all in one click' button.
It is a common request for this, but still we apologize for the inconveniece for now.


Comment actions Permalink

Ok, that's fine.

But is there a way to configure it to make a more appropriate suggestion for the refactor?

i.e. When there is a field called "m_objectRef", i'd like the suggestion to be "_objectRef", not "_mObjectRef". That alone would make it faster to improve this issue with my code. At the moment, every field that needs refactoring needs me to manually edit the name and that is really slow.

Comment actions Permalink

Hi Jon,

You may try to use 'ReSharper | Find | Search with Pattern' and use the replace pattern there. I've attached screenshot of a search pattern for a reference.

Hope it helps.


Please sign in to leave a comment.