4 using System.Configuration;
6 namespace MonoTests.SystemWeb.Framework
8 public class CustomSection : ConfigurationSection
10 [ConfigurationProperty ("sections", IsRequired = true)]
11 public CustomSubSectionCollection AreaSections {
13 return (CustomSubSectionCollection) base["sections"];
16 base["sections"] = value;
21 public class CustomSubSectionCollection : ConfigurationElementCollection
23 protected override ConfigurationElement CreateNewElement () {
24 return new CustomTagCollection ();
27 protected override object GetElementKey (ConfigurationElement element) {
28 return (element as CustomTagCollection).Area;
32 public class CustomTagCollection : ConfigurationElementCollection
34 protected override ConfigurationElement CreateNewElement () {
35 return new CustomTagElement ();
38 protected override object GetElementKey (ConfigurationElement element) {
39 return ((CustomTagElement) element).Name;
42 [ConfigurationProperty ("area", DefaultValue = "UndefinedArea", IsKey = true, IsRequired = true)]
45 return (string) base["area"];
50 public class CustomTagElement : ConfigurationElement
52 [ConfigurationProperty ("name", DefaultValue = "CustomName", IsKey = true, IsRequired = true)]
55 return (string) base["name"];