Does Properties increase memory size of Instances?

后端 未结 5 722
天涯浪人
天涯浪人 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:33

    Properties are just like ordinary methods in that respect.

    The code needs to be stored somewhere (once per Type) and any fields that are used (Auto properties!) need to be stored per instance. Local variables will also take up some memory.

提交回复
热议问题