2010-06-21 Marek Habersack <mhabersack@novell.com>
[mcs.git] / class / System / System.Configuration / DictionarySectionHandler.cs
blob11fb2ec8e302c5fabb7834348aa80277650a9b3f
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 // System.Configuration.DictionarySectionHandler.cs
26 // Author:
27 // Christopher Podurgiel (cpodurgiel@msn.com)
29 // (C) Chris Podurgiel
31 using System;
32 using System.Collections;
33 using System.Collections.Specialized;
34 #if (XML_DEP)
35 using System.Xml;
36 #else
37 using XmlNode = System.Object;
38 #endif
40 namespace System.Configuration
42 /// <summary>
43 /// Summary description for DictionarySectionHandler.
44 /// </summary>
45 public class DictionarySectionHandler : IConfigurationSectionHandler
47 /// <summary>
48 /// Creates a new DictionarySectionHandler object and adds the object to the collection.
49 /// </summary>
50 /// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
51 /// <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>
52 /// <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>
53 /// <returns></returns>
54 public virtual object Create(object parent, object context, XmlNode section)
56 #if (XML_DEP)
57 return ConfigHelper.GetDictionary (parent as IDictionary, section,
58 KeyAttributeName, ValueAttributeName);
59 #else
60 return null;
61 #endif
64 /// <summary>
65 /// Gets the name of the key attribute tag. This property is overidden by derived classes to change
66 /// the name of the key attribute tag. The default is "key".
67 /// </summary>
68 protected virtual string KeyAttributeName
70 get {
71 return "key";
75 /// <summary>
76 /// Gets the name of the value tag. This property may be overidden by derived classes to change
77 /// the name of the value tag. The default is "value".
78 /// </summary>
79 protected virtual string ValueAttributeName
81 get {
82 return "value";