The Labs \ Source Viewer \ SSCLI \ System.Configuration \ KeyValueInternalCollection

  1. //------------------------------------------------------------------------------
  2. // <copyright file="KeyValueInternalCollection.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.Configuration
  16. {
  17.     using System;
  18.     using System.Xml;
  19.     using System.Configuration;
  20.     using System.Collections.Specialized;
  21.     using System.Collections;
  22.     using System.IO;
  23.     using System.Text;
  24.    
  25.     // class AppSettingsSection
  26.    
  27.     class KeyValueInternalCollection : NameValueCollection
  28.     {
  29.         private AppSettingsSection _root = null;
  30.         public KeyValueInternalCollection(AppSettingsSection root)
  31.         {
  32.             _root = root;
  33.             foreach (KeyValueConfigurationElement element in _root.Settings) {
  34.                 base.Add(element.Key, element.Value);
  35.             }
  36.         }
  37.        
  38.         public override void Add(string key, string value)
  39.         {
  40.             _root.Settings.Add(new KeyValueConfigurationElement(key, value));
  41.             base.Add(key, value);
  42.         }
  43.        
  44.         public override void Clear()
  45.         {
  46.             _root.Settings.Clear();
  47.             base.Clear();
  48.         }
  49.        
  50.         public override void Remove(string key)
  51.         {
  52.             _root.Settings.Remove(key);
  53.             base.Remove(key);
  54.         }
  55.        
  56.        
  57.     }
  58. }

Developer Fusion