日期:2014-05-18 浏览次数:20815 次
[Serializable] public class DomainBase : INotifyPropertyChanged { #region 基类属性 /// <summary> /// 基类属性 /// </summary> private int _id; public virtual int ID { get { return _id; } set { if (value != _id) { _id = value; PropChanged(); } } } private string _no; public virtual string NO { get { return _no; } set { if (value != _no) { _no = value; PropChanged(); } } } private bool _isChanged; public virtual bool IsChanged { get { return _isChanged; } } #endregion #region 属性更新通知 public virtual event PropertyChangedEventHandler PropertyChanged; protected void PropChanged() { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { _isChanged = true; string name = new StackTrace().GetFrame(1).GetMethod().Name.Substring(4); handler(this, new PropertyChangedEventArgs(name)); } } #endregion }
http://www.codeproject.com/KB/tips/SerializedObjectCloner.aspx
http://www.codeproject.com/KB/cs/cloneimpl_class.aspx
http://goneale.com/2009/02/16/cloning-object-properties-via-reflection/