本文介绍了未使用的类属性会发生什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道实例化对象时类的未使用属性会发生什么情况?
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?
推荐答案
是的,它们仍在内存中,并带有类型的默认值。任何调用的属性集都会增加引用类型的内存使用量,无论是否调用get。
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.
这篇关于未使用的类属性会发生什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!