依赖属性 ".NET properties are nothing more than syntactic sugar over set and get methods." 我们知道.NET的属性只不过是get/set方法的语法糖衣. "Dependency properties are the workhorse of WPF. This infrastructure provides for many of WPF's features, such as data bin
介绍装饰器.继承.元类.mixin,四种給类动态添加类属性和方法的方式 有时候需要給类添加额外的东西,有些东西很频繁,每个类都需要,如果不想反复的复制粘贴到每个类,可以动态添加. # coding=utf-8 def create_class_attribution(cls): def _inner(*args, **kwargs): if not hasattr(cls, 'xx'): cls.xx = 1 def funa(self, a, b): return a + b if not h