using System.Reflection; namespace Waaagh.Helpers { public interface IUpdateReferences { void UpdateReferences(T value); } static internal class ModelUpdateHelper { static public void UpdateWritableProperies(ref T source, T value) where T : IUpdateReferences { Type type = typeof(T); PropertyInfo[] properties = type.GetProperties(); foreach (PropertyInfo property in properties) { if (property.CanWrite) { property.SetValue(source, property.GetValue(value)); } } } } }