private void UpdateObject(Distributor _newDistributor, ref Distributor _oldDistributor) { try { foreach (PropertyInfo DistributorPropInfo in _newDistributor.GetType().GetProperties().ToList()) { _oldDistributor.GetType().GetProperty(DistributorPropInfo.Name).SetValue(_oldDistributor, _newDistributor.GetType().GetProperty(DistributorPropInfo.Name).GetValue(_newDistributor)); } } catch (Exception e) { Console.WriteLine(e); throw; } }