public void Add(string name)
{
if (((this._thisElement.ItemLocked & ConfigurationValueFlags.Locked) != ConfigurationValueFlags.Default) && ((this._thisElement.ItemLocked & ConfigurationValueFlags.Inherited) != ConfigurationValueFlags.Default))
{
throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_attribute_locked", new object[] { name }));
}
ConfigurationValueFlags modified = ConfigurationValueFlags.Modified;
string attribToLockTrim = name.Trim();
ConfigurationProperty property = this._thisElement.Properties[attribToLockTrim];
if ((property == null) && (attribToLockTrim != "*"))
{
ConfigurationElementCollection elements = this._thisElement as ConfigurationElementCollection;
if ((elements == null) && (this._thisElement.Properties.DefaultCollectionProperty != null))
{
elements = this._thisElement[this._thisElement.Properties.DefaultCollectionProperty] as ConfigurationElementCollection;
}
if (((elements == null) || (this._lockType == ConfigurationLockCollectionType.LockedAttributes)) || (this._lockType == ConfigurationLockCollectionType.LockedExceptionList))
{
this._thisElement.ReportInvalidLock(attribToLockTrim, this._lockType, null, null);
}
else if (!elements.IsLockableElement(attribToLockTrim))
{
this._thisElement.ReportInvalidLock(attribToLockTrim, this._lockType, null, elements.LockableElements);
}
}
else
{
if ((property != null) && property.IsRequired)
{
throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_required_attribute_lock_attempt", new object[] { property.Name }));
}
if (attribToLockTrim != "*")
{
if ((this._lockType == ConfigurationLockCollectionType.LockedElements) || (this._lockType == ConfigurationLockCollectionType.LockedElementsExceptionList))
{
if (!typeof(ConfigurationElement).IsAssignableFrom(property.Type))
{
this._thisElement.ReportInvalidLock(attribToLockTrim, this._lockType, null, null);
}
}
else if (typeof(ConfigurationElement).IsAssignableFrom(property.Type))
{
this._thisElement.ReportInvalidLock(attribToLockTrim, this._lockType, null, null);
}
}
}
if (this.internalDictionary.Contains(name))
{
modified = ConfigurationValueFlags.Modified | ((ConfigurationValueFlags)this.internalDictionary[name]);
this.internalDictionary.Remove(name);
this.internalArraylist.Remove(name);
}
this.internalDictionary.Add(name, modified);
this.internalArraylist.Add(name);
this._bModified = true;
}