public void Clone(CachedValue target) { var inObjType = target.GetType(); foreach (var field in this.GetType().GetFields()) { var targetField = inObjType.GetField(field.Name); if (targetField != null) { field.SetValue(this, targetField.GetValue(target)); } else { field.SetValue(this, null); } } }