protected void SetPropertyValue <T>(IPropertyDescriptor <T> propertyDescriptor, T propertyValue) { if (propertyDescriptor == null) { throw new ArgumentNullException("propertyDescriptor"); } T oldPropertyValue; if (!propertyDescriptor.TryGetValue(out oldPropertyValue) || !Object.Equals(oldPropertyValue, propertyValue)) { UpdateAndFireNotifications(propertyDescriptor, propertyValue); } }
protected T GetPropertyValue <T>(IPropertyDescriptor <T> propertyDescriptor) { if (propertyDescriptor == null) { throw new ArgumentNullException("propertyDescriptor"); } T propertyValue; if (!propertyDescriptor.TryGetValue(out propertyValue)) { propertyValue = propertyDescriptor.GetDefaultValue(); UpdateAndFireNotifications(propertyDescriptor, propertyValue); } return(propertyValue); }