Resharper - private vs backing field
Is there a way to tell R# to apply different naming strategy for property backing fields (_camelCase) vs c开发者_StackOverflow中文版lass instance fields (camelCase)?
Reason: I want my dependencies to be named just a any other variable. Especially if the type of the field is the same as the field name. For example
private readonly MetaService metaService;
No, I don't know of a way to do this.
Frankly, I don't understand the distinction.
- A private instance field may later be used as the backing field for a property. Would you then feel it necessary to change the name of that field?
- The property may become disused and may then be removed. Do you then want to rename the field? It would no longer be a backing field.
The naming convention for a property backing field should be the same as that for a class instance field. The only difference between the two is that one can be manipulated or accessed from the outside.
If you feel the need to make a distinction, add a comment.
精彩评论