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

Key: RSRP-62840
Type: New Feature New Feature
Status: Open Open
Priority: Normal Normal
Assignee: Ilya Ryzhenkov
Reporter: Nazar Revutsky
Votes: 0
Watchers: 1
Operations

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

Allow generate auto property with private setters

Created: 27 Mar 08 21:11   Updated: 21 Apr 08 19:29
Component/s: Code Cleanup
Fix Version/s: Alderman
Security Level: Everybody (All jira users)

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

Build: 763


 Description  « Hide
code cleanup generate auto properties with { get; set;}

Allow generate auto property with private setters (make this customizable in settings)



 All   Comments   Work Log   Change History      Sort Order:
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.

Ilya Ryzhenkov - 21 Apr 08 14:53
Nazar, could you elaborate more on this issue? We think we don't quite understand the request.

Nazar Revutsky - 21 Apr 08 19:29
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;
	}
}