Rename property modifies field name casing question / request 3.0+

I currently have my naming conventions set so that all field variables should begin with . The problem is that if I create a field called "xray":

private int _xray;

I then encapsulate it (Alt-Ins, Generate Read Property):

public int Xray
{
get
{
return this._xray;
}
}

When I rename it to XRayImage, it tries to rename the field to _XRayImage, but I want it to be _xrayImage (or _xRayImage) ... I.E. I would like to set not only the prefix of the field variable, but also the casing of that variable (pascal, camel, lower, upper, etc).

Is there an item that does this currently in resharper (I seem to remember 2.5 didn't do the casing change) -- and/or can I request that as a feature?

3 comments
Comment actions Permalink

Hello Chadwick,

This problem also exposes itself if you work in the opposite direction.

if you first create the property without first creating the field:

public int Xray
{
get { return _xray; }
set { _xray = value; }
}

the quick fix suggests creating a new field name _Xray as one of its options as my attachment shows.
I accept it and then rename it but then during the rename process it wants to rename the property to _Xray which I have to deselect before proceeding.

Matt

I currently have my naming conventions set so that all field variables
should begin with _. The problem is that if I create a field called
"_xray":

>

private int _xray;

>

I then encapsulate it (Alt-Ins, Generate Read Property):

>

public int Xray
{
get
{
return this._xray;
}
}
When I rename it to XRayImage, it tries to rename the field to
_XRayImage, but I want it to be _xrayImage (or _xRayImage) ... I.E. I
would like to set not only the prefix of the field variable, but also
the casing of that variable (pascal, camel, lower, upper, etc).

>

Is there an item that does this currently in resharper (I seem to
remember 2.5 didn't do the casing change) -- and/or can I request that
as a feature?

>

Attachment not added (general error): "incorrect quick-fix suggestion.PNG"

0
Comment actions Permalink

I'm seeing similar in 451 too.


0

Please sign in to leave a comment.