Protected Internal properties vs Protected properties and Resharper
I've开发者_StackOverflow just picked up Resharper and have been playing around converting fields to properties. I want these properties to be protected, but Resharper doesn't want to give me that option. Instead there is only a Protected Internal option. This has me thinking. Either there is a rule somewhere that properties should always be 'protected internal' rather than just 'protected'. Or I just don't know how to use resharper. Which is it?
Update: Contacted Jetbrains themselves and they have identified this behaviour as a bug and raised a bug report. Marc's answer is essentially correct on the usage of 'protected internal' so he gets the tick.
What are the fields at the moment? public
? I wonder if you have some code in other types that is already touching the properties, and thus would break if they were just protected
. I don't know how resharper feels about it, but it is not necessary (or even particularly common) to make things protected internal
- so protected
should be a reasonable option.
精彩评论