当从类外部访问成员时,封装显然是有用且必不可少的,但是当在内部引用类变量时,调用其私有成员或使用其getter更好吗?如果你的getter只是返回变量,那么性能是否存在差异?
c# getter performance encapsulation properties
c# ×1
encapsulation ×1
getter ×1
performance ×1
properties ×1