Пример #1
0
        public virtual void CopyFromSource(BindableModel source)
        {
            var properties = GetType().GetProperties().ToList();

            properties.ForEach(x =>
            {
                if (x.CanWrite)
                {
                    x.SetValue(this, x.GetValue(source));
                }
            }
                               );
        }
Пример #2
0
        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);
        }