Reputation: 29251
I would like to do something like:
public class TaskDto : IDto
{
//ReSharper disable ConvertToAutoProperty
private int _id;
public int ID { get { return _id; }}
//ReSharper enable ConvertToAutoProperty
}
ConvertToAutoProperty isn't the correct name of the rule -- I was just taking a stab at it. Google isn't turning up anything. I don't see the ability to suppress the warning via the ReSharper context menu. I still would like to see this rule in general, just not for IDs in my DTO classes.
Any ideas?
Upvotes: 4
Views: 751
Reputation: 10118
Try this:
// ReSharper disable ConvertToAutoPropertyWithPrivateSetter
private int _id;
public int ID { get { return _id; } }
// ReSharper restore ConvertToAutoPropertyWithPrivateSetter
ReSharper should have offered you an option to generate this automatically. Seems like a bug here, so created a request here http://youtrack.jetbrains.com/issue/RSRP-329913
Upvotes: 4