public void Remove(string name) {
if (!internalDictionary.Contains(name)) {
throw new ConfigurationErrorsException(SR.GetString(SR.Config_base_collection_entry_not_found, name));
}
// in a locked list you cannot remove items that were locked in the parent
// in an exception list this is legal because it makes the list more restrictive
if (_bExceptionList == false &&
((ConfigurationValueFlags)internalDictionary[name] & ConfigurationValueFlags.Inherited) != 0) {
if (((ConfigurationValueFlags)internalDictionary[name] & ConfigurationValueFlags.Modified) != 0) {
// allow the local one to be "removed" so it won't write out but throw if they try and remove
// one that is only inherited
ConfigurationValueFlags flags = (ConfigurationValueFlags)internalDictionary[name];
flags &= ~ConfigurationValueFlags.Modified;
internalDictionary[name] = flags;
_bModified = true;
return;
}
else {
throw new ConfigurationErrorsException(SR.GetString(SR.Config_base_attribute_locked, name));
}
}
internalDictionary.Remove(name);
internalArraylist.Remove(name);
_bModified = true;
}