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

Contains() public method

public Contains ( string name ) : bool
name string
return bool
        public bool Contains(string name) {
            if (_bExceptionList && name.Equals(_ignoreName)) {
                return true;
            }
            return internalDictionary.Contains(name);
        }
        

Usage Example

 internal ConfigurationLockCollection UnMergeLockList(
     ConfigurationLockCollection sourceLockList,
     ConfigurationLockCollection parentLockList,
     ConfigurationSaveMode saveMode) {
     if (sourceLockList.ExceptionList == false) {
         switch (saveMode) {
             case ConfigurationSaveMode.Modified: {
                     ConfigurationLockCollection tempLockList = new ConfigurationLockCollection(this, sourceLockList.LockType);
                     foreach (string lockedAttributeName in sourceLockList)
                         if (!parentLockList.Contains(lockedAttributeName) ||
                             sourceLockList.IsValueModified(lockedAttributeName)) {
                             tempLockList.Add(lockedAttributeName, ConfigurationValueFlags.Default);
                         }
                     return tempLockList;
                 }
             case ConfigurationSaveMode.Minimal: {
                     ConfigurationLockCollection tempLockList = new ConfigurationLockCollection(this, sourceLockList.LockType);
                     foreach (string lockedAttributeName in sourceLockList)
                         if (!parentLockList.Contains(lockedAttributeName)) {
                             tempLockList.Add(lockedAttributeName, ConfigurationValueFlags.Default);
                         }
                     return tempLockList;
                 }
         }
     }
     else {
         // exception list write out the entire collection unless the entire collection
         // came from the parent.
         if (saveMode == ConfigurationSaveMode.Modified || saveMode == ConfigurationSaveMode.Minimal) {
             bool sameAsParent = false;
             if (sourceLockList.Count == parentLockList.Count) {
                 sameAsParent = true;
                 foreach (string lockedAttributeName in sourceLockList) {
                     if (!parentLockList.Contains(lockedAttributeName) ||
                         (sourceLockList.IsValueModified(lockedAttributeName) &&
                          saveMode == ConfigurationSaveMode.Modified)) {
                         sameAsParent = false;
                     }
                 }
             }
             if (sameAsParent == true) {
                 return null;
             }
         }
     }
     return sourceLockList;
 }
All Usage Examples Of System.Configuration.ConfigurationLockCollection::Contains