Andy,
There are plenty of articles out there that should get you started. But, in a nutshell, you should find it very easy to switch from the App Block to Sys.Config. To start with, you'll need to create a new class that inherits from System.Configuration.ConfigurationSection, as follows:
public sealed class MySection : System.Configuration.ConfigurationSection
{
private static System.Configuration.ConfigurationProperty _myProperty;
public MySection() : base()
{
_myProperty = new System.Configuration.ConfigurationProperty(
"myProperty",
typeof(MyPropertySettings),
null,
System.Configuration.ConfigurationPropertyOptions.None);
Properties.Add(_myProperty);
}
[System.Configuration.ConfigurationProperty("enabled", DefaultValue = "false")]
public System.Boolean Enabled
{
get { return (System.Boolean)base["enabled"]; }
set { base["enabled"] = value; }
}
[System.Configuration.ConfigurationProperty("myProperty")]
public MyPropertySettings MyProperty
{
get { return base["myProperty"] as MyPropertySettings; }
set { base["myProperty"] = value; }
}
}
This is a simple example of a section with a single attribute and one child element. It would appear in the config file as:
<configSections>
<section name="mySection" type="MySection" />
</configSections><mySection enabled="[true|false]">
<myProperty ...>
</mySection>
To create the inner element, you'd follow the same pattern except inherit from ConfigurationElement.
Hope that gets you started in the right direction!
Copyright (c) Marimer LLC