最开始见的是PostSharp的一个实现: http://doc.postsharp.net/inotifypropertychanged-add。不过PostSharp是收费的,后来也逐渐由了许多其它的免费的解决方案。本文这里介绍的是一个开源的解决方案:Fody。html
使用它很是简单,首先经过Nuget安装库:PM> Install-Package PropertyChanged.Fody。而后在须要实现属性通知的类上加一个[ImplementPropertyChanged]便可:git
[AddINotifyPropertyChangedInterface] public class Person { public string GivenNames { get; set; } public string FamilyName { get; set; } public string FullName => string.Format("{0} {1}", GivenNames, FamilyName); }