Performance overhead for properties in .NET

前端 未结 9 1954
隐瞒了意图╮
隐瞒了意图╮ 2020-12-10 01:43

I read somewhere that having public properties is preferable to having public members in a class.

  1. Is this only because of abstaraction and modularity? Are

9条回答
  •  渐次进展
    2020-12-10 02:08

    Don't worry at all about the performance overhead. It is so minor that you should not consider weakening the encapsulation of the class; it would be premature optimization of the worst sort.

提交回复
热议问题