protected internal Object this[ConfigurationProperty prop] {
get {
Object o = _values[prop.Name];
if (o == null) {
lock (_values.SyncRoot) {
o = _values[prop.Name];
if (o == null) {
if (typeof(ConfigurationElement).IsAssignableFrom(prop.Type)) {
ConfigurationElement childElement = CreateElement(prop.Type);
if (_bReadOnly) {
childElement.SetReadOnly();
}
if (typeof(ConfigurationElementCollection).IsAssignableFrom(prop.Type)) {
ConfigurationElementCollection childElementCollection = childElement as ConfigurationElementCollection;
if (prop.AddElementName != null)
childElementCollection.AddElementName = prop.AddElementName;
if (prop.RemoveElementName != null)
childElementCollection.RemoveElementName = prop.RemoveElementName;
if (prop.ClearElementName != null)
childElementCollection.ClearElementName = prop.ClearElementName;
}
//_values[prop.Name] = childElement;
_values.SetValue(prop.Name, childElement, ConfigurationValueFlags.Inherited, null);
o = childElement;
}
else {
o = prop.DefaultValue;
}
}
}
}
else if (o == s_nullPropertyValue) {
o = null;
}
// If its an invalid value - throw the error now
if (o is InvalidPropValue) {
throw ((InvalidPropValue)o).Error;
}
return o;
}
set {
SetPropertyValue(prop, value,false); // Do not ignore locks!!!
}
}