public virtual BaseClass Assign(object source) { var propertyInfos = GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public) .Where(x => x.GetCustomAttribute(typeof(IgnoreAttribute)) == null).ToArray(); var absentProperties = new List <string>(); foreach (PropertyInfo propertyInfo in propertyInfos) { try { propertyInfo.SetValue(this, PropertyValueManager.GetValue(propertyInfo.Name, source)); } catch (ArgumentException ex) { throw new CanNotAssignPropertyException( string.Format("Can not assign property '{0}' from " + "instance of '{1}' to instance of '{2}'", propertyInfo.Name, source.GetType(), GetType()), ex); } catch (ThereIsNoPropertyException) { absentProperties.Add(propertyInfo.Name); } } if (absentProperties.Count > 0) { throw new ThereIsNoPropertyException(absentProperties, source); } return(this); }