internal bool UpdatePropertyCollection()
{
bool bIsModified = false;
ArrayList removeList = null;
if (_PropertyNameCollection != null)
{
// remove any data that has been delete from the collection
foreach (ConfigurationProperty prop in _properties)
{
if (prop.Name != "name" && prop.Name != "type")
{
if (_PropertyNameCollection.Get(prop.Name) == null)
{
// _properties.Remove(prop.Name);
if (removeList == null)
removeList = new ArrayList();
if ((Values.GetConfigValue(prop.Name).ValueFlags & ConfigurationValueFlags.Locked) == 0) {
removeList.Add(prop.Name);
bIsModified = true;
}
}
}
}
if (removeList != null)
{
foreach (string propName in removeList)
{
_properties.Remove(propName);
}
}
// then copy any data that has been changed in the collection
foreach (string Key in _PropertyNameCollection)
{
string valueInCollection = _PropertyNameCollection[Key];
string valueInBag = GetProperty(Key);
if (valueInBag == null || valueInCollection != valueInBag) // add new property
{
SetProperty(Key, valueInCollection);
bIsModified = true;
}
}
}
_PropertyNameCollection = null;
return bIsModified;
}