'Encaplusate field' doesn't merge setter and getter into a single property
Suppose you have the following code:
class Green
{
private int _saturation = 0;
public int Saturation
{
get { return _saturation; }
}
}
Select _saturartion field and choose ReSharper>Refactor>Encapsulate field...
Check only 'Encapsulate writes' checkbox.
The following code will be generated:
class Green
{
private int _saturation = 0;
public int Saturation
{
get { return _saturation; }
}
public int Saturation
{
set { _saturation = value; }
}
}
Note that now there are 2 properties with the same name Saturation, it will cause a compilation error. I propose they should be merged into a single property. The following result is expected:
class Green
{
private int _saturation = 0;
public int Saturation
{
get { return _saturation; }
set { _saturation = value; }
}
}
/*
VS 2005 version 8.0.50727.51
ReSharper build 252
*/
Please sign in to leave a comment.