2 using System.Configuration;
4 namespace MonoTests.SystemWeb.Framework
6 public class CustomSection : ConfigurationSection
8 [ConfigurationProperty ("sections", IsRequired = true)]
9 public CustomSubSectionCollection AreaSections {
11 return (CustomSubSectionCollection) base["sections"];
14 base["sections"] = value;
19 public class CustomSubSectionCollection : ConfigurationElementCollection
21 protected override ConfigurationElement CreateNewElement () {
22 return new CustomTagCollection ();
25 protected override object GetElementKey (ConfigurationElement element) {
26 return (element as CustomTagCollection).Area;
30 public class CustomTagCollection : ConfigurationElementCollection
32 protected override ConfigurationElement CreateNewElement () {
33 return new CustomTagElement ();
36 protected override object GetElementKey (ConfigurationElement element) {
37 return ((CustomTagElement) element).Name;
40 [ConfigurationProperty ("area", DefaultValue = "UndefinedArea", IsKey = true, IsRequired = true)]
43 return (string) base["area"];
48 public class CustomTagElement : ConfigurationElement
50 [ConfigurationProperty ("name", DefaultValue = "CustomName", IsKey = true, IsRequired = true)]
53 return (string) base["name"];