public virtual void CopyFromSource(BindableModel source) { var properties = GetType().GetProperties().ToList(); properties.ForEach(x => { if (x.CanWrite) { x.SetValue(this, x.GetValue(source)); } } ); }
public virtual BindableModel Copy() { BindableModel ret = (BindableModel)Activator.CreateInstance(GetType()); // shallow copy var properties = GetType().GetProperties().ToList(); properties.ForEach(x => { if (x.CanWrite) { x.SetValue(ret, x.GetValue(this)); } } ); return(ret); }