properties - Why won't anyone accept public fields in C#? -


It seems like every C # static analyst wants to complain when it sees the public sector. but why? Definitely there are cases where a public (or internal) field is sufficient, and having a property with its get_ and set_ Does not make any sense? What if I know that I will not redefine the area or by adding it (side effect is bad, is not it?) - Is there no ordinary field enough?

This is actually about your proof of future proofing. When you say (emphasis my):

What if I'm sure that I will not redefine the area or add to it (bad effect bad Are right?) - Should not a simple field be enough?

This is a complete statement, and as we know (simultaneously the most stable analyzer), there are only two complete properties in life. / P>

This is just trying to protect you from it if it is a problem, you should be able to ignore the analyst (through attributes that depend on the analysis tool you are using) .


Comments