public void UnsetValue(CompositeObject obj) { if (_wasSet) { var propToUnset = PropertyManager.Instance.GetProperties(obj.GetType()) .FirstOrDefault(p => p.PropName == Property); obj.SetValue(propToUnset, Value); _oldValue = CompositeObjectProperty.UnsetValue; _wasSet = false; } }
public void SetValue(CompositeObject obj) { var propToSet = PropertyManager.Instance.GetProperties(obj.GetType()) .FirstOrDefault(p => p.PropName == Property); if (propToSet is null) { throw new Exception(); } _wasSet = obj.IsPropertySet(propToSet); if (_wasSet) { _oldValue = obj.GetValue <IPropertyValue>(propToSet); } obj.SetValue(propToSet, Value); }