Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First you add a property in the class that extends Section:</p> <pre><code>[ConfigurationProperty("pages", IsDefaultCollection = false)] [ConfigurationCollection(typeof(PageCollection), AddItemName = "add")] public PageCollection Pages { get { return (PageCollection) this["pages"]; } } </code></pre> <p>Then you need to make a PageCollection class. All the examples I've seen are pretty much identical so just copy <a href="http://sourceforge.net/p/nmailserver/code/HEAD/tree/NMail/trunk/NMail/Configuration/NamedServiceCollection.cs" rel="noreferrer">this one</a> and rename "NamedService" to "Page".</p> <p>Finally add a class that extends ObjectConfigurationElement:</p> <pre><code>public class PageElement : ObjectConfigurationElement { [ConfigurationProperty("title", IsRequired = true)] public string Title { get { return (string) this["title"]; } set { this["title"] = value; } } [ConfigurationProperty("url", IsRequired = true)] public string Url { get { return (string) this["url"]; } set { this["url"] = value; } } } </code></pre> <p>Here are some files from a sample implementation:</p> <ul> <li><a href="http://sourceforge.net/p/nmailserver/code/HEAD/tree/NMail/trunk/NMail.Server.Console/NMail.config" rel="noreferrer">Sample config</a></li> <li><a href="http://sourceforge.net/p/nmailserver/code/HEAD/tree/NMail/trunk/NMail/Configuration/NamedServiceCollection.cs" rel="noreferrer">Collection and element classes</a></li> <li><a href="http://sourceforge.net/p/nmailserver/code/HEAD/tree/NMail/trunk/NMail/Configuration/NMailConfiguration.cs" rel="noreferrer">Config section class</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload