Does Properties increase memory size of Instances?

后端 未结 5 568
天涯浪人
天涯浪人 2021-01-19 10:30

This is probably a stupid question, but does object Properties occupy any memory per instance?

As I\'ve understand it when you instantiate an object each value field

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-19 11:12

    No, properties are just syntactic sugar for getter and setter methods. Only the backing fields occupy memory. If you have no backing fields, you will have no per-instance memory usage.

提交回复
热议问题