System.Configuration.ConfigurationLockCollection.Add C# (CSharp) Method

Add() private method

private Add ( string name, ConfigurationValueFlags flags ) : void
name string
flags ConfigurationValueFlags
return void
        internal void Add(string name, ConfigurationValueFlags flags) {
            if ((flags != ConfigurationValueFlags.Inherited) && (internalDictionary.Contains(name))) {
                // the user has an item declared as locked below a level where it is already locked
                // keep enough info so we can write out the lock if they save in modified mode
                flags = ConfigurationValueFlags.Modified | (ConfigurationValueFlags)internalDictionary[name];
                internalDictionary.Remove(name);
                internalArraylist.Remove(name);
            }

            internalDictionary.Add(name, flags); // not from parent
            internalArraylist.Add(name);
        }

Same methods

ConfigurationLockCollection::Add ( string name ) : void

Usage Example

 internal ConfigurationLockCollection UnMergeLockList(ConfigurationLockCollection sourceLockList, ConfigurationLockCollection parentLockList, ConfigurationSaveMode saveMode)
 {
     if (!sourceLockList.ExceptionList)
     {
         switch (saveMode)
         {
             case ConfigurationSaveMode.Modified:
             {
                 ConfigurationLockCollection locks = new ConfigurationLockCollection(this, sourceLockList.LockType);
                 foreach (string str in sourceLockList)
                 {
                     if (!parentLockList.Contains(str) || sourceLockList.IsValueModified(str))
                     {
                         locks.Add(str, ConfigurationValueFlags.Default);
                     }
                 }
                 return locks;
             }
             case ConfigurationSaveMode.Minimal:
             {
                 ConfigurationLockCollection locks2 = new ConfigurationLockCollection(this, sourceLockList.LockType);
                 foreach (string str2 in sourceLockList)
                 {
                     if (!parentLockList.Contains(str2))
                     {
                         locks2.Add(str2, ConfigurationValueFlags.Default);
                     }
                 }
                 return locks2;
             }
         }
         return sourceLockList;
     }
     if ((saveMode == ConfigurationSaveMode.Modified) || (saveMode == ConfigurationSaveMode.Minimal))
     {
         bool flag = false;
         if (sourceLockList.Count == parentLockList.Count)
         {
             flag = true;
             foreach (string str3 in sourceLockList)
             {
                 if (!parentLockList.Contains(str3) || (sourceLockList.IsValueModified(str3) && (saveMode == ConfigurationSaveMode.Modified)))
                 {
                     flag = false;
                 }
             }
         }
         if (flag)
         {
             return null;
         }
     }
     return sourceLockList;
 }
All Usage Examples Of System.Configuration.ConfigurationLockCollection::Add