Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-328929: Extract Parameters with lowercase naming conventions causes property names of extracted class to be appended with 1

$
0
0
Reporter Jeff Barnes (jeff.barnes) Jeff Barnes (jeff.barnes)
Created Aug 3, 2012 7:40:07 PM
Updated Apr 16, 2018 3:18:00 PM
Resolved Apr 16, 2018 3:18:00 PM
Subsystem Refactorings
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Obsolete
Type Usability Problem
Fix version No Fix versions
Affected versions 7.0
Fixed In Version ReSharper Undefined
VsVersion All Versions
I have Resharper configured with lowercase naming conventions for methods, properties, and parameters. For example, a parameter for first name would be spelled as first_name rather than FirstName. When I extract a class from parameters, the generated class uses property names that are appended with the number 1.

Here is an example:

public void method(string first_name, string last_name, string phone_number)
{
// Blah
}

Extract parameters to class named Person will result in:

public class Person
{
string first_name;
string last_name;
string phone_number;

public Person(string first_name, string last_name_, string phone_number)
{
this.first_name = first_name;
this.last_name = last_name;
this.phone_number = phone_number;
}

public string first_name1
{
get { return first_name; }
}

public string last_name1
{
get { return last_name; }
}

public string phone_number1
{
get { return phone_number; }
}
}


Ideally, I would prefer to see the generated class look like:

public class Person
{
public Person(string first_name, string last_name_, string phone_number)
{
this.first_name = first_name;
this.last_name = last_name;
this.phone_number = phone_number;
}

public string first_name
{
get; private set;
}

public string last_name
{
get; private set;
}

public string phone_number
{
get; private set;
}
}


Currently, I can work around this issue by converting the properties to automatic properties and rename the property names. However, I would rather not have to do this extra effort every time that I extract a class from parameters. Please add support to gracefully handle this scenario without appending numbers to the name of properties. This could be avoided with an option for automatic properties in this scenario.

I'm using build 7.0.97.60.

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>