System.Configuration.ProviderSettings.UpdatePropertyCollection C# (CSharp) Метод

UpdatePropertyCollection() приватный Метод

private UpdatePropertyCollection ( ) : bool
Результат bool
        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;
        }

Usage Example

 public void Add(ProviderSettings provider)
 {
     if (provider != null)
     {
         provider.UpdatePropertyCollection();
         this.BaseAdd(provider);
     }
 }
All Usage Examples Of System.Configuration.ProviderSettings::UpdatePropertyCollection