What happens with Unused Class Properties

假如想象 提交于 2020-01-06 07:07:33

问题


I am interested to know what happens with unused properties of a class when an object is instantiated?

Are there performance hits for having additional unused properties? What about complex properties that are accessing the database, but I'm not using them, are they still being loaded?


回答1:


Yes, they are still in memory with default values for the types. Any property sets called will increase memory usage on reference types, whether get is called or not.



来源:https://stackoverflow.com/questions/3415315/what-happens-with-unused-class-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!