Are protected members/fields really that bad?

前端 未结 6 1586
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 02:33

Now if you read the naming conventions in the MSDN for C# you will notice that it states that properties are always preferred over public and protected fields. I have even

6条回答
  •  北海茫月
    2020-11-29 03:14

    I agree with the read-only property answer. But to play devil's advocate here, it really depends on what you're doing. I'll be happy to admit i write code with public members all the time (i also don't comment, follow guidelines, or any of the formalities).

    But when i'm at work that's a different story.

提交回复
热议问题