|
|
|
[
Permlink
| « Hide
]
Ilya Ryzhenkov - 15 Apr 08 18:05
I suppose code cleanup should leave external interface of a type intact. So that if property had just getter, it should convert to autoproperty with private setter.
Nazar, could you elaborate more on this issue? We think we don't quite understand the request.
Now: If I run 'Code cleanup' with option 'Use auto-property, if possible' only not accessed fields are replaced.
for example class A
{
private int _X = 1;
private int _Y;
private int _Z = 2;
public int X
{
get { return _X; }
set { _X = value; }
}
public int Y
{
get { return _Y; }
set { _Y = value; }
}
public int Z
{
get { return _Z; }
}
}
got: class A
{
private int _X = 1;
private int _Z = 2;
public int X
{
get { return _X; }
set { _X = value; }
}
public int Y { get; set; }
public int Z
{
get { return _Z; }
}
}
but best solution is: class A
{
public int X { get; set; }
public int Y { get; set; }
public int Z { get; private set; }
public A()
{
X = 1;
Z = 2;
}
}
|
|||||||||||||||||||||||||||||||||||||||||||||||||