#116 – Dependency Property Values Are Stored in the DependencyObject(依赖属性存储在DependencyObject中)
来源:互联网 发布:网络代购英文怎么说 编辑:程序博客网 时间:2024/05/24 00:43
原文地址:https://wpf.2000things.com/2010/11/05/116-dependency-property-values-are-stored-in-the-dependencyobject/
标准的CLR属性值是存储在定义该属性的实例中的,即使这个属性自创建以后从来没有被复制或者更改,它依然会占用内存空间。
而依赖属性的值只有被设置为非默认值的时候才会被存储(值不占用内存空间),而当访问没有设置值的依赖属性将会只返回一个默认的值。
被设置的依赖属性的值会被存在DependencyObject 类的一个数组中,这个数组,通过GetValue 和SetValue 方法读写实现,是DependencyObject 派生类的一部分,这个内部的数组中包含着所有被设置了值的依赖属性的有效值。
*******************
通过上面的描述,个人总结就是,如果依赖属性没有设置值的话,继承自DependencyObject 的数组中没有它的值,因此它的值不占用内存空间。
0 0
- #116 – Dependency Property Values Are Stored in the DependencyObject(依赖属性存储在DependencyObject中)
- #160 – Be Careful When Setting Dependency Property Values from a DependencyObject Constructor
- WPF中DependencyObject使用
- #131 – Dependency Properties Inherit Values from Higher Up in the Logical Tree(逻辑树中元素的依赖属性可从其上层元素继承)
- Dependency Property 依赖属性
- 依赖属性Dependency Property
- #154 – Reusing an Existing Dependency Property in Your Class(重用依赖属性)
- WPF Background property does not point to a dependencyobject in path '(0).(1)'
- #122 – Validating a Dependency Property(验证依赖属性)
- WPF中的依赖属性(Dependency Property)
- Silverlight:Dependency Property(依赖属性)
- 隶属于普通类型(与DependencyObject和DependencyProperty相区别)的属性的绑定
- #118 – Don’t Add Code to Dependency Property Getter/Setter(不要在依赖属性的Getter/Setter中加入处理代码)
- WPF中DependencyObject与DependencyProperty的源码简单剖析
- #114 – How Dependency Properties Are Implemented(依赖属性是如何应用的)
- #117 – Registering a Dependency Property(注册一个依赖属性)
- #120 – Clearing a Dependency Property Value(清除依赖属性的值)
- #123 – Coercing a Dependency Property(强制转换依赖属性的值)
- SQL Server2005连接Oracle 11g详细步骤
- A. Little Artem and Presents
- (词法结构)JavaScript权威指南笔记2
- 遍历python字典几种方法
- (01)javascript 数据类型
- #116 – Dependency Property Values Are Stored in the DependencyObject(依赖属性存储在DependencyObject中)
- Exception in thread "http-bio-8080-exec-10" java.lang.OutOfMemoryError: PermGen space
- handlebars自定义helper的写法
- 携车网产品线框图
- CentOS 6.5 搭建PHP环境(Nginx+MariaDB+PHP7)
- 第十三周项目二动物这样叫二
- android studio的安装
- STM8 IAR中新建工程详解
- Unity3d 5.x 学习笔记(2)—— 键盘控制物体移动与转向 (move and rotate)