public object GetValue(ElementProperty property, object defaultValue)
        {
            if (mergeElement == null) return defaultValue;
            if (!mergeElement.OverriddenProperties.AllKeys.Contains(property.ConfigurationName)) return defaultValue;

            string overriddenValue = mergeElement.OverriddenProperties[property.ConfigurationName].Value;
            return property.Converter.ConvertFromString(property, CultureInfo.CurrentUICulture, overriddenValue);
        }
        public void SetValue(ElementProperty property, object value)
        {
            if (mergeElement == null) throw new InvalidOperationException("TODO");

            string valueToSet = (string) Convert.ChangeType(value, typeof(string));
            string propertyName = property.ConfigurationName;

            if (!mergeElement.OverriddenProperties.AllKeys.Contains(propertyName))
            {
                var overriddenProperty = new KeyValueConfigurationElement(propertyName, valueToSet);
                this.mergeElement.OverriddenProperties.Add(overriddenProperty);
            }
            else
            {
                mergeElement.OverriddenProperties[propertyName].Value = valueToSet;
            }
        }
 private static IComparable GetOtherBoundary(ElementProperty property)
 {
     string propertyToFetch = property.PropertyName == "UpperBound" ? "LowerBound" : "UpperBound";
     return (IComparable)property.DeclaringElement.Properties.Single(p => p.PropertyName == propertyToFetch).Value;
 }