DictionarySectionHandler.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // System.Configuration.DictionarySectionHandler.cs
  3. //
  4. // Author:
  5. // Christopher Podurgiel ([email protected])
  6. //
  7. // (C) Chris Podurgiel
  8. //
  9. using System;
  10. using System.Collections;
  11. using System.Collections.Specialized;
  12. using System.Xml;
  13. namespace System.Configuration
  14. {
  15. /// <summary>
  16. /// Summary description for DictionarySectionHandler.
  17. /// </summary>
  18. public class DictionarySectionHandler : IConfigurationSectionHandler
  19. {
  20. /// <summary>
  21. /// Creates a new DictionarySectionHandler object and adds the object to the collection.
  22. /// </summary>
  23. /// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
  24. /// <param name="context">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
  25. /// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
  26. /// <returns></returns>
  27. public virtual object Create(object parent, object context, XmlNode section)
  28. {
  29. return ConfigHelper.GetDictionary (parent as IDictionary, section,
  30. KeyAttributeName, ValueAttributeName);
  31. }
  32. /// <summary>
  33. /// Gets the name of the key attribute tag. This property is overidden by derived classes to change
  34. /// the name of the key attribute tag. The default is "key".
  35. /// </summary>
  36. protected virtual string KeyAttributeName
  37. {
  38. get {
  39. return "key";
  40. }
  41. }
  42. /// <summary>
  43. /// Gets the name of the value tag. This property may be overidden by derived classes to change
  44. /// the name of the value tag. The default is "value".
  45. /// </summary>
  46. protected virtual string ValueAttributeName
  47. {
  48. get {
  49. return "value";
  50. }
  51. }
  52. }
  53. }