How to disable ReSharper ConvertToAutoProperty warning for certain properties?

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 is not the right name for the rule - I just hit him. Google does nothing. I see no way to suppress a warning through the ReSharper context menu. I would still like to see this rule at all, just not for identifiers in my DTO classes.

Any ideas?

enter image description here

+4
source share
1 answer

Try the following:

 // ReSharper disable ConvertToAutoPropertyWithPrivateSetter private int _id; public int ID { get { return _id; } } // ReSharper restore ConvertToAutoPropertyWithPrivateSetter 

ReSharper should have offered you the opportunity to generate this automatically. It seems like an error here, so I created a request here http://youtrack.jetbrains.com/issue/RSRP-329913

+4
source

Source: https://habr.com/ru/post/1433863/


All Articles