History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RSRP-30221
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Dmitry Lomov
Reporter: Greg Law
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
ReSharper

Rename fields and properties

Created: 20 Oct 06 12:55   Updated: 20 Jun 07 10:58
Component/s: Refactorings - Rename
Fix Version/s: 4.0
Security Level: Everybody (All jira users)

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 265


 Description  « Hide
Renaming fields with matching property accessors does not work correctly. I'm working with a class generated by MyGeneration in which I need to rename the fields to match our naming conventions (leading underscore and camel case). There are four general cases.

1. The field and property accessor contain one word:

private int _Word;
public int Word { get; set; }

Select Rename on _Word. ReSharper recommends _word and does not prompt to rename the Word property since its name already matches. This one actually works as expected.

2. The field and property accessor contain two words and are renamed to correct the case:

private int _DoubleWord;
public int DoubleWord { get; set; }

Select Rename on _DoubleWord. ReSharper recommends _doubleWord, but prompts to rename the DoubleWord property to Word. It should keep DoubleWord to match the field name.

3. The field and property accessor contain two words and renamed to different words:

private int _someName;
public int SomeName { get; set; }

Rename _someName to _totallyDifferent. ReSharper recommends renaming the property accessor to SomeDifferent, which is the first word of the original name and second word of the new name so you get this:

private int _totallyDifferent;
public int SomeDifferent { get; set; }

4. The field and property accessor contain two words in all caps:

private int _CAPS_Word;
public int CAPS_Word { get; set; }

Select Rename on _CAPS_Word. Override the recommended default to name the field _anotherName and click Continue. ReSharper now prompts to rename the property accessor to NAMEWord. Note that NAME is the second word in the new name capitalized to match the first word in the original name, and Word is the second word in the original name.

As another example:

private int _XYZ_Something;
public int XYZ_Something { get; set; }

Rename the field to _totallyDifferent:

private int _totallyDifferent;
public int DIFFERENTSomething { get; set; }



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.